Lng { public static long[] sliceOf( long[] 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 ) ); } long[] newArray = new long[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }  static String str( long value ); static long[] grow( long[] array, final int size ); static long[] grow( long[] array ); static long[] shrink( long[] array, int size ); static long[] compact( long[] array ); static long[] arrayOfLong( final int size ); static long[] array( final long... array ); static int len( long[] array ); static int lengthOf( long[] array ); static long idx( final long[] array, final int index ); static long atIndex( final long[] array, final int index ); static void idx( final long[] array, int index, long value ); static void atIndex( final long[] array, int index, long value ); static long[] slc( long[] array, int startIndex, int endIndex ); static long[] sliceOf( long[] array, int startIndex, int endIndex ); static long[] slc( long[] array, int startIndex ); static long[] sliceOf( long[] array, int startIndex ); static long[] slcEnd( long[] array, int endIndex ); static long[] endSliceOf( long[] array, int endIndex ); static boolean in( long value, long[] array ); static long[] copy( long[] array ); static long[] add( long[] array, long v ); static long[] add( long[] array, long[] array2 ); static long[] insert( final long[] array, final int idx, final long v ); static long[] insert( final long[] array, final int fromIndex, final long[] values ); static long reduceBy( final long[] array, ReduceBy reduceBy ); static long reduceBy( final long[] array, final int start, final int length, ReduceBy reduceBy ); static long reduceBy( final long[] array, final int length, ReduceBy reduceBy ); static long reduceBy( final long[] array, T object ); static long reduceBy( final long[] array, T object, String methodName ); static long reduceBy( final long[] array,  int length,
                                 Object object ); static long reduceBy( final long[] array,  int length,
                                 Object function, String functionName ); static long reduceBy( final long[] array, int start, int length,
                                 Object object ); static boolean equalsOrDie(long expected, long got); static boolean equals(long expected, long got); static long sum( long[] values ); static long sum( long[] values,  int length ); static long sum( long[] values, int start, int length ); static long max( long[] values, final int start, final int length ); static long max( long[] values ); static long max( long[] values, int length ); static long min( long[] values, final int start, final int length ); static long min( long[] values ); static long min( long[] values, int length ); static long mean( long[] values, final int start, final int length ); static long mean( long[] values, final int length ); static long mean( long[] values ); static long variance(long[] values, final int start, final int length); static double meanDouble( long[] values, final int start, final int length ); static double varianceDouble(long[] values, final int start, final int length); static long variance(long[] values,  final int length); static long variance(long[] values); static long standardDeviation(long[] values, final int start, final int length); static long standardDeviation(long[] values,  final int length); static int standardDeviation(long[] values); static long median(long[] values, final int start, final int length); static long median(long[] values, final int length); static long median(long[] values); static boolean equalsOrDie(long[] expected, long[] got); static boolean equals(long[] expected, long[] got); static boolean equals(int start, int end, long[] expected, long[] got); static int hashCode(long array[]); static int hashCode(int start, int end, long array[]);  }
@Test public void testSliceOf() { long[] array = Lng.array(0, 1, 2, 3, 4, 5, 6); long[] array2 = Lng.sliceOf(array, 0, 100); Lng.equalsOrDie(array, array2); }