title: How to read from file and store multiple integers on one line into arraylist?
body: <p>Having an issue when ran I get Exception in thread &quot;main&quot; java.util.InputMismatchException.
  I tried to debug and noticed that it will read from the file and store 10,10,1 but then it stops..</p>
  <p>Example File:</p>
  <pre><code>testsom 10 testson 10
  bgn 1 2
  </code></pre>
  <p>I think it's because of the white space but i'm not entirely sure.</p>
  <pre><code>public void readInput(String filename) throws IOException 
  {
  
          File file = new File(filename);
  
          Scanner scan = new Scanner(file);
  
          ArrayList&lt;Integer&gt; values = new ArrayList&lt;Integer&gt;();
  
          int num = 0;
          while(scan.hasNextLine())
          {
              scan.next();
  
              num = scan.nextInt();
              values.add(num);
             // scan.nextInt();
              
          }
  }
  </code></pre>