title: Reading CSV file in Java and storing the values in an int array
body: <p>I have a CSV file of strings in this format:</p>
  
  <pre><code>14/10/2011  422     391.6592    394.52324   0.039215686
  13/10/2011  408.43  391.7612    395.0686031 0.039215686
  12/10/2011  402.19  391.834     395.3478736 0.039215686
  </code></pre>
  
  <p>All I want to do is read in the csv file and then store the 3rd and 4th coloumns data in integer arrays.</p>
  
  <p>This is the code I have written:</p>
  
  <pre><code>    BufferedReader CSVFile = 
              new BufferedReader(new FileReader("appleData.csv"));
  
      String dataRow = CSVFile.readLine(); 
      int count = 0;
  
      while (dataRow != null){
          String[] dataArray = dataRow.split(",");
  
          EMA[count] = dataArray[2];
          SMA[count] = dataArray[3];
  
          dataRow = CSVFile.readLine(); // Read next line of data.
      }
      // Close the file once all data has been read.
      CSVFile.close();
  </code></pre>
  
  <p>I want to end up with two arrays, EMA which contains all the values from the 3rd coloumn and SMA which contains the values from the 4th coloumn.</p>
  
  <p>I am getting a null pointer exception. Can someone please tell me what mistake I am making?</p>