code: public double[] subseriesByCopy(double[] series, int start, int end)
        throws IndexOutOfBoundsException {
      if ((start > end) || (start < 0) || (end > series.length)) {
        throw new IndexOutOfBoundsException("Unable to extract subseries, series length: "
            + series.length + ", start: " + start + ", end: " + String.valueOf(end - start));
      }
      return Arrays.copyOfRange(series, start, end);
    }
docs: Extract subseries out of series.
  
  @param series The series array.
  @param start the fragment start.
  @param end the fragment end.
  @return The subseries.
  @throws IndexOutOfBoundsException If error occurs.