code: public static ArrayList<double[]> readText(String featuresFileName, int featureLength) throws Exception {
  		ArrayList<double[]> features = new ArrayList<double[]>();
  		BufferedReader in = new BufferedReader(new FileReader(new File(featuresFileName)));
  
  		String line;
  		while ((line = in.readLine()) != null) {
  			String[] stringVals = line.split(",");
  			if (stringVals.length != featureLength) {
  				in.close();
  				throw new Exception("Line contains " + stringVals.length
  						+ " comma separated values instead of " + featureLength + "\n" + line);
  			}
  			double[] vals = new double[featureLength];
  			for (int j = 0; j < featureLength; j++) {
  				vals[j] = Double.parseDouble(stringVals[j]);
  			}
  			features.add(vals);
  		}
  		in.close();
  		return features;
  	}
docs: Reads features from a text file and returns them in an ArrayList<double[]>.
  
  @param featuresFileName
  The text file containing the features.
  @param featureLength
  The length of each feature.
  @return
  @throws Exception