title: reading a csv file into a array
body: <p>I am trying to read the csv file, "read_ex.csv", into an array. I have searched endlessly on the web/stackoverflow to find a way to read the file into an array. The best i have been able to do is read it in a streaming fashion, but I cant store it in an array due the variable size of the file. I belive that ArrayList is a method to deal with variable size array, but I don't know how to work with it. Essentially I want to be able to access the String array "values" after the while loop finishes.  </p>
  
  <pre><code>import java.util.Scanner;
  import java.io.FileNotFoundException;
  import java.io.File;
  
  public class sortarray {
       public static void main (String []agrs){
           String fileName= "read_ex.csv";
           File file= new File(fileName);
  
  
           try{
               Scanner inputStream= new Scanner(file);
               while(inputStream.hasNext()){
               String data= inputStream.next();
               String[] values = data.split(",");
               System.out.println(values[1]);
               }
               inputStream.close();
            }catch (FileNotFoundException e) {
               e.printStackTrace();
       }
       //This prints out the working directory
       System.out.println("Present Project Directory : "+ System.getProperty("user.dir"));
  
      }           
  
  }
  </code></pre>