code: private static double distance(double[] subseries, double[] series, int from, int to,
        double nThreshold) throws Exception {
      double[] subsequence = tp.znorm(tp.subseriesByCopy(series, from, to), nThreshold);
      Double sum = 0D;
      for (int i = 0; i < subseries.length; i++) {
        double tmp = subseries[i] - subsequence[i];
        sum = sum + tmp * tmp;
      }
      return Math.sqrt(sum);
    }
docs: Calculates the Euclidean distance between two points. Don't use this unless you need that.
  
  @param subseries The first subsequence -- ASSUMED TO BE Z-normalized.
  @param series The second point.
  @param from the initial index of the range to be copied, inclusive
  @param to the final index of the range to be copied, exclusive. (This index may lie outside the
  array.)
  @param nThreshold z-Normalization threshold.
  @return The Euclidean distance between z-Normalized versions of subsequences.