Reading integers from a file separated by space in java
<p>Input file containing integers will be like this:</p>

<pre><code>     5 2 3 5
     2 4 23 4 5 6 4
</code></pre>

<p>So how would I read the first line, separate it by space and add these numbers to Arraylist1. Then read the second line, separate it by space and add the numbers to ArrayList2 and so on. (So Arraylist1 will contain [5,2,3,5] etc)</p>

<pre><code>    FileInputStream fstream = new FileInputStream("file.txt");
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String data;
    while ((data = br.readLine()) != null)   {
      //How can I do what I described above here?
    }
</code></pre>
