code: public double seriesDistance(double[][] series1, double[][] series2) throws Exception {
      if (series1.length == series2.length) {
        Double res = 0D;
        for (int i = 0; i < series1.length; i++) {
          res = res + distance2(series1[i], series2[i]);
        }
        return Math.sqrt(res);
      }
      else {
        throw new Exception("Exception in Euclidean distance: array lengths are not equal");
      }
    }
docs: Calculates Euclidean distance between two multi-dimensional time-series of equal length.
  
  @param series1 The first series.
  @param series2 The second series.
  @return The eclidean distance.
  @throws Exception if error occures.