Java Input Needed Twice
<p>Hi so I'm having issues with an input validation code I have. I enter in my seed value it prompts me for, but afterwards I have to enter in another valid input in order to get my menu choice to print out. It happens every time I also choose one of the menu choices as well.</p>

<p>The input validation is supposed to take in integer values between 1 through 5 only. So if someone puts in letters, negative numbers, or integers not within the range, it asks them to put one in so that they can continue with menu choices.</p>

<p>Am I writing the code wrong? I want to get rid of that unnecessary second input and just only need one in order to continue with game. I also notice values after 10 works for some reason, even though 6-9 are counted as invalid. I'm not sure why that works. Thanks!</p>

<pre><code>import java.util.Random;
import java.util.Scanner;

public class Sonowah
{

    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        System.out.print("Please enter a seed value [integer]: "); 
        //assume input is interger for seed for RNG
        int seed = in.nextInt(); 
        Random rng = new Random(seed); //RNG

        int charge = 100;

    //loop here
    while (charge &gt; 0)
    {           
        int number;
        do 
        {
            while (!in.hasNextInt(5))
            {
                System.out.println("Please enter valid interger");
                in.next();
            }
            number = in.nextInt();
        } 
        while (number &lt;= 0);
        System.out.println("Interger is valid!");


            System.out.println("1. Surrender");
        System.out.println("2. Defend");
        System.out.println("3. Fight");
            System.out.println("4. Charge");
            System.out.println("5. Potions");
            String menuchoice = in.next();

            if (menuchoice.equals("1"))
            {
                    statement
                }
</code></pre>
