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);
}

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 ) ; }
extract subseries out of series .
