title: Reading double values from a file
body: <p>I'm trying to read some numbers (double) from a file and store them in an ArrayList and an array (yes, I need both) with the code below:</p>
  
  <pre><code>try {
      Scanner scan = new Scanner(file).useDelimiter("\\s*\\n");
  
      while(scan.hasNextDouble())
      {
          tmp.add(scan.nextDouble());
      }
  
      Double[][] tmp2 = new Double[tmp.size()/2][2];
      int tmp3 = 0;
      for(int i = 0; i &lt; tmp.size()/2; i++)
      {
          for(int j = 0; j &lt; 2; j++)
          {
              tmp2[i][j] = tmp.get(tmp3);
              tmp3++;
          }
      }
  
  } catch (FileNotFoundException e1) {
      e1.printStackTrace();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The file I'm trying to read is:</p>
  
  <pre><code>0.0 0.0
  0.023 0.023
  0.05 0.05
  0.2 0.2
  0.5 0.5
  0.8 0.8
  0.950 0.950
  0.977 0.977
  1.0 1.0</code></pre>
  
  <p>But well my code doesn't work, the hasNextDouble() function doesn't find anything, what am I doing wrong?</p>
  
  <p>EDIT: ok so I edited the source a bit (changed from Object[][] to Double[][]) and added inserting values into the array after they were inserted into the ArrayList, but it still doesn't work - the 'while' loop isn't executed a single time.</p>