Adding numbers read from a file to a totalAmount initialized to 0 giving an unexpected result
<p>I have a small homework application that writes random numbers from 5 to 77 to a text file, and then a separate application that reads the file and totals the numbers.</p>

<p>Here is my code for writing the numbers to the text file...</p>

<pre><code>Random r = new Random();
    int min = 5;
    int max = 77;
    int[]randomNumbers = new int[1000];

    try
    {
        PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("myTextFile.txt")), true);
        for(int i = 0; i &lt; randomNumbers.length; i++)
        {
            randomNumbers[i] = r.nextInt(max - min + 1) + min;
            pw.println(randomNumbers[i]);
        }

    }
    catch(IOException io){} 
</code></pre>

<p>Here is my code for reading the file and totalling the amount...</p>

<pre><code>int totalAmount = 0;

public void run()
{
    try
    {
        BufferedReader buffy = new BufferedReader(new FileReader("myTextFile.txt"));
        String s;

        while((s = buffy.readLine()) != null)
        {
            int number = Integer.parseInt(s);
            totalAmount += number;
            System.out.println(totalNumbers);

        }



    }
    catch(IOException io){}
}
</code></pre>

<p>The output however starts with <strong>29633</strong> and displays numbers all the way to <strong>42328</strong></p>

<p>Why do I get this result... just trying to understand the wrong part of my code</p>
