title: Getting specific column from text file into an array
body: <p>What I need to achieve is to import data from a text file that contains two columns of doubles as follows:</p>
  
  <pre><code>201.0176    1.06E+03
  201.7557    1.11E+01
  202.0201    2.02E+02
  202.2064    9.76E+00
  202.8342    1.11E+01
  203.0161    2.02E+02
  203.1638    9.61E+00
  203.3843    1.13E+01
  </code></pre>
  
  <p>There are up to about 50,000 lines of these data.  I want each column to be imported into a separate array but I cannot work out how to identify between the separate columns.  I have tried the following:</p>
  
  <pre><code>public class CodeTests {
  
      public static ArrayList assignArray(String filePath) throws FileNotFoundException {
          Scanner s = new Scanner(new File(filePath));
              ArrayList&lt;Double&gt; list = new ArrayList&lt;Double&gt;();
              while (s.hasNext()){
                  list.add(s.nextDouble());
              }
              s.close();
              return list;
      }
  
      public static void main(String[] args) throws IOException {
          /*
           * 
           */
          ArrayList arrayMZ;
          arrayMZ = assignArray("F:/Stuff/Work/Work from GSK/From Leeds/ja_CIDFragmenter/testFile.txt");
  
          for(int i = 0; i &lt; arrayMZ.size(); i++)
              System.out.println(arrayMZ.get(i));
          System.out.println("End");
      }
  }
  </code></pre>
  
  <p>From running this I get the output:</p>
  
  <pre><code>run:
  201.0176
  1060.0
  201.7557
  11.1
  202.0201
  202.0
  202.2064
  9.76
  202.8342
  11.1
  203.0161
  202.0
  203.1638
  9.61
  203.3843
  11.3
  End
  BUILD SUCCESSFUL (total time: 1 second)
  </code></pre>
  
  <p>Can anyone help me either separate these columns into two arrays or even into a single 2D array under the columns of array[0] with the first data column in it and array[1] with the second. i.e. :</p>
  
  <pre><code>  [0]         [1]
  201.0176    1.06E+03
  201.7557    1.11E+01
  202.0201    2.02E+02
  202.2064    9.76E+00
  202.8342    1.11E+01
  203.0161    2.02E+02
  203.1638    9.61E+00
  203.3843    1.13E+01
  </code></pre>
  
  <p>I've tried to make this as clear as I can but if there is anything else please let me know.</p>
  
  <p>Thanks</p>