code: public static Map<String, List<double[]>> readUCRData(String fileName)
        throws IOException, NumberFormatException {
  
      Map<String, List<double[]>> res = new HashMap<String, List<double[]>>();
  
      BufferedReader br = new BufferedReader(new FileReader(new File(fileName)));
      String line = "";
      while ((line = br.readLine()) != null) {
        if (line.trim().length() == 0) {
          continue;
        }
        String[] split = line.trim().split("[\\,\\s]+");
  
        String label = split[0];
        Double num = parseValue(label);
        String seriesType = label;
        if (!(Double.isNaN(num))) {
          seriesType = String.valueOf(num.intValue());
        }
        double[] series = new double[split.length - 1];
        for (int i = 1; i < split.length; i++) {
          series[i - 1] = Double.valueOf(split[i].trim()).doubleValue();
        }
  
        if (!res.containsKey(seriesType)) {
          res.put(seriesType, new ArrayList<double[]>());
        }
  
        res.get(seriesType).add(series);
      }
  
      br.close();
      return res;
  
    }
docs: Reads bunch of series from file. First column treats as a class label. Rest as a real-valued
  series.
  
  @param fileName the input filename.
  @return time series read.
  @throws IOException if error occurs.
  @throws NumberFormatException if error occurs.