title: ArrayList not reading in properly
body: <p>I have an ArrayList &amp; I Want it to read in &amp; Total the numbers within the file, but it is only outputting the last number within the file, they are all on different lines etc.</p>
  
  <pre><code>Here is my code, thanks in advance: 
  
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.ArrayList;
  import java.util.Scanner;
  
  public class ArrayListOfNumbers {
      public static void main(String[] args) throws FileNotFoundException {
  
          ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
          list.add(1);
          Scanner Scan = new Scanner (new File("numbers.txt"));
  
          int sumOf = 0;
          for(int i=0; i &lt; list.size(); i++){
              sumOf = sumOf + list.get(i);
          }
          //while scanning add sum to ArrayList List
          while (Scan.hasNext())
          {
              sumOf = Scan.nextInt();
              list.add(sumOf);
          }
          //print the array list
          System.out.println(sumOf);
          Scan.close();
      }
  }
  </code></pre>