public static long atIndex( final long[] array, final int index ) { final int i = calculateIndex( array, index ); return array[ i ]; }
public static void idx( final long[] array, int index, long value ) { final int i = calculateIndex( array, index ); array[ i ] = value; }
public static void atIndex( final long[] array, int index, long value ) { final int i = calculateIndex( array, index ); array[ i ] = value; }
public static void atIndex( final long[] array, int index, long value ) { final int i = calculateIndex( array, index ); array[ i ] = value; }
public static long atIndex( final long[] array, final int index ) { final int i = calculateIndex( array, index ); return array[ i ]; }
public static void idx( final long[] array, int index, long value ) { final int i = calculateIndex( array, index ); array[ i ] = value; }
public static long idx( final long[] array, final int index ) { final int i = calculateIndex( array, index ); return array[ i ]; }
public static long idx( final long[] array, final int index ) { final int i = calculateIndex( array, index ); return array[ i ]; }
public static long[] sliceOf( long[] array, int startIndex ) { final int start = calculateIndex( array, startIndex ); final int newLength = array.length - start; if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, length %d", startIndex, array.length ) ); } long[] newArray = new long[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }
public static long[] slc( long[] array, int startIndex ) { final int start = calculateIndex( array, startIndex ); final int newLength = array.length - start; if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, length %d", startIndex, array.length ) ); } long[] newArray = new long[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }
public static long[] slc( long[] array, int startIndex ) { final int start = calculateIndex( array, startIndex ); final int newLength = array.length - start; if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, length %d", startIndex, array.length ) ); } long[] newArray = new long[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }
public static long[] sliceOf( long[] array, int startIndex ) { final int start = calculateIndex( array, startIndex ); final int newLength = array.length - start; if ( newLength < 0 ) { throw new ArrayIndexOutOfBoundsException( String.format( "start index %d, length %d", startIndex, array.length ) ); } long[] newArray = new long[ newLength ]; System.arraycopy( array, start, newArray, 0, newLength ); return newArray; }
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; }
public static long[] slc( 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; }
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; }
public static long[] slc( 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; }
public static long[] insert( final long[] array, final int idx, final long v ) { Exceptions.requireNonNull( array ); if ( idx >= array.length ) { return add( array, v ); } final int index = calculateIndex( array, idx ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); long[] newArray = new long[ array.length + 1 ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int remainingIndex = array.length - index; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + 1, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + 1, remainingIndex ); } newArray[ index ] = v; return newArray; }
public static long[] insert( final long[] array, final int idx, final long v ) { Exceptions.requireNonNull( array ); if ( idx >= array.length ) { return add( array, v ); } final int index = calculateIndex( array, idx ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); long[] newArray = new long[ array.length + 1 ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int remainingIndex = array.length - index; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + 1, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + 1, remainingIndex ); } newArray[ index ] = v; return newArray; }
public static long[] insert( final long[] array, final int fromIndex, final long[] values ) { Exceptions.requireNonNull( array ); if ( fromIndex >= array.length ) { return add( array, values ); } final int index = calculateIndex( array, fromIndex ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); long[] newArray = new long[ array.length + values.length ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int toIndex = index + values.length; int remainingIndex = newArray.length - toIndex; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + values.length, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + values.length, remainingIndex ); } for ( int i = index, j = 0; i < toIndex; i++, j++ ) { newArray[ i ] = values[ j ]; } return newArray; }
public static long[] insert( final long[] array, final int fromIndex, final long[] values ) { Exceptions.requireNonNull( array ); if ( fromIndex >= array.length ) { return add( array, values ); } final int index = calculateIndex( array, fromIndex ); //Object newArray = Array.newInstance(array.getClass().getComponentType(), array.length+1); long[] newArray = new long[ array.length + values.length ]; if ( index != 0 ) { /* Copy up to the length in the array before the index. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, 0, newArray, 0, index ); } boolean lastIndex = index == array.length - 1; int toIndex = index + values.length; int remainingIndex = newArray.length - toIndex; if ( lastIndex ) { /* Copy the area after the insert. Make sure we don't write over the end. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + values.length, remainingIndex ); } else { /* Copy the area after the insert. */ /* src sbegin dst dbegin length of copy */ System.arraycopy( array, index, newArray, index + values.length, remainingIndex ); } for ( int i = index, j = 0; i < toIndex; i++, j++ ) { newArray[ i ] = values[ j ]; } return newArray; }