Searching text files to get specific double
<p>I am writing a bank account program for my Comp Sci class, and need to search a .txt file for a account number a user enters (which is an int) and then pull out the next row which is the balance. i.e. the user enters the account #12345679 and i need to pull out the balance of it. Below is an example of the txt file</p>

<pre><code>12345678
133.87
12345679
500.00
12345670
123.00
</code></pre>

<p>So far I have and I know that i'm going to have to put how to get the balance in the if statment</p>

<pre><code>while (accountTries &lt; 3)
        {
            System.out.println("Please enter your 8 digit account number");
            accountNumber = console.next();
            accountLength = accountNumber.length();
            while (in.hasNextInt())
           {
                line = in.hasNextInt();
                if (accountLength == 8 &amp;&amp; line == accountNumber  )
                    {
                    accountTries = 3;           
                    }
            }
            System.out.println("INVALID ACCOUNT NUMBER.");
            accountTries++;
            }
        }//End of while loop
</code></pre>
