@Universal public static double[] slcEnd( final double[] array, final int endIndex ) { final int end = calculateEndIndex(array, endIndex); final int newLength = end; // + (endIndex < 0 ? 1 : 0); if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, length %d", endIndex, array.length ) ); } double[] newArray = new double[ newLength ]; System.arraycopy( array, 0, newArray, 0, newLength ); return newArray; }
@Universal public static double[] slcEnd( final double[] array, final int endIndex ) { final int end = calculateEndIndex(array, endIndex); final int newLength = end; // + (endIndex < 0 ? 1 : 0); if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, length %d", endIndex, array.length ) ); } double[] newArray = new double[ newLength ]; System.arraycopy( array, 0, newArray, 0, newLength ); return newArray; }
@Universal public static double[] slcEnd( final double[] array, final int endIndex ) { final int end = calculateEndIndex(array, endIndex); final int newLength = end; // + (endIndex < 0 ? 1 : 0); if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, length %d", endIndex, array.length ) ); } double[] newArray = new double[ newLength ]; System.arraycopy( array, 0, newArray, 0, newLength ); return newArray; }
@Universal public static double[] slc( double[] array, int startIndex, int endIndex ) { final int start = calculateIndex( array, startIndex ); final int end = calculateEndIndex(array, endIndex); final int newLength = end - start; if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, end index %d, length %d", startIndex, endIndex, array.length ) ); } double[] newArray = new double[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }
@Universal public static double[] slc( double[] array, int startIndex, int endIndex ) { final int start = calculateIndex( array, startIndex ); final int end = calculateEndIndex(array, endIndex); final int newLength = end - start; if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, end index %d, length %d", startIndex, endIndex, array.length ) ); } double[] newArray = new double[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }
@Universal public static double[] slc( double[] array, int startIndex, int endIndex ) { final int start = calculateIndex( array, startIndex ); final int end = calculateEndIndex(array, endIndex); final int newLength = end - start; if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, end index %d, length %d", startIndex, endIndex, array.length ) ); } double[] newArray = new double[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }