code: public static double[] readTS(BufferedReader br, int columnIdx, int sizeLimit)
        throws IOException, SAXException {
      ArrayList<Double> preRes = new ArrayList<Double>();
      int lineCounter = 0;
  
      String line = null;
      while ((line = br.readLine()) != null) {
        String[] split = line.trim().split("\\s+");
        if (split.length < columnIdx) {
          String message = "Unable to read data from column " + columnIdx;
          br.close();
          throw new SAXException(message);
        }
        String str = split[columnIdx];
        double num = Double.NaN;
        try {
          num = Double.valueOf(str);
        }
        catch (NumberFormatException e) {
          LOGGER.info("Skipping the row " + lineCounter + " with value \"" + str + "\"");
          continue;
        }
        preRes.add(num);
        lineCounter++;
        if ((0 != sizeLimit) && (lineCounter >= sizeLimit)) {
          break;
        }
      }
      br.close();
      double[] res = new double[preRes.size()];
      for (int i = 0; i < preRes.size(); i++) {
        res[i] = preRes.get(i);
      }
      return res;
  
    }
docs: Reads timeseries from a file. Assumes that file has a single double value on every line.
  Assigned timestamps are the line numbers.
  
  @param br The reader to use.
  @param columnIdx The column index.
  @param sizeLimit The number of lines to read, 0 == all.
  @return data.
  @throws IOException if error occurs.
  @throws SAXException if error occurs.