title: java read only integers from file
body: <p>If I have a file that contains for example:</p>
  
  <pre><code>results1: 2, 4, 5, 6, 7, 8, 9
  results2: 5, 3, 7, 2, 8, 5, 2
  </code></pre>
  
  <p>I want to add the integers from each line to a array. One array
  for each line. How can I do this with code that does only read the integers?</p>
  
  <p>Here's what I got this far</p>
  
  <pre><code> String data = null;
      try {
  
  
          Scanner in = new Scanner(new File(myFile));
  
          while (in.hasNextLine()) {
  
  
                  data = in.nextLine();
  
                  numbers.add(data);
  
  
          }
          in.close();
  
      } catch (Exception e) {
  
      }
  </code></pre>