@Test public void growTest() { byte[] letters = array( ( byte ) 'a', ( byte ) 'b', ( byte ) 'c', ( byte ) 'd', ( byte ) 'e' ); letters = grow( letters, 21 ); assertEquals( 'e', idx( letters, 4 ) ); assertEquals( 'a', idx( letters, 0 ) ); assertEquals( len( letters ), 26 ); assertEquals( '\0', idx( letters, 20 ) ); letters = shrink( letters, 23 ); assertArrayEquals( array( ( byte ) 'a', ( byte ) 'b', ( byte ) 'c' ), letters ); }
public static byte[] grow( byte[] array, final int size ) { byte[] newArray = new byte[ array.length + size ]; System.arraycopy( array, 0, newArray, 0, array.length ); return newArray; }
Byt { public static byte[] grow( byte[] array, final int size ) { byte[] newArray = new byte[ array.length + size ]; System.arraycopy( array, 0, newArray, 0, array.length ); return newArray; } }
Byt { public static byte[] grow( byte[] array, final int size ) { byte[] newArray = new byte[ array.length + size ]; System.arraycopy( array, 0, newArray, 0, array.length ); return newArray; }  }
Byt { public static byte[] grow( byte[] array, final int size ) { byte[] newArray = new byte[ array.length + size ]; System.arraycopy( array, 0, newArray, 0, array.length ); return newArray; }  static byte[] grow( byte[] array, final int size ); static byte[] grow( byte[] array ); static byte[] shrink( byte[] array, int size ); static byte[] compact( byte[] array ); static byte[] arrayOfByte( final int size ); static byte[] array( final byte... array ); static byte[] bytes( final byte... array ); static byte[] bytes( String str ); static int len( byte[] array ); static int lengthOf( byte[] array ); static byte atIndex( final byte[] array, final int index ); static byte idx( final byte[] array, final int index ); static void atIndex( final byte[] array, int index, byte value ); static void idx( final byte[] array, int index, byte value ); static byte[] sliceOf( byte[] array, int startIndex, int endIndex ); static byte[] slc( byte[] array, int startIndex, int endIndex ); static byte[] sliceOf( byte[] array, int startIndex ); static byte[] slc( byte[] array, int startIndex ); static byte[] endSliceOf( byte[] array, int endIndex ); static byte[] slcEnd( byte[] array, int endIndex ); static boolean in( int value, byte... array ); static boolean inIntArray( byte value, int[] array ); static boolean in( int value, int offset, byte[] array ); static boolean in( int value, int offset, int end, byte[] array ); static byte[] copy( byte[] array ); static byte[] copy( byte[] array, int offset, int length ); static byte[] add( byte[] array, byte v ); static byte[] add( byte[] array, byte[] array2 ); static byte[] insert( final byte[] array, final int idx, final byte v ); static byte[] insert( final byte[] array, final int fromIndex, final byte[] values ); static int idxInt( byte[] bytes, int off ); static byte[] addInt( byte[] array, int v ); static byte[] insertIntInto( byte[] array, int index, int v ); static void intTo( byte[] b, int off, int val ); static void longTo( byte[] b, int off, long val ); static byte[] addLong( byte[] array, long value ); static long idxUnsignedInt( byte[] bytes, int off ); static long idxLong( byte[] b, int off ); static short idxShort( byte[] b, int off ); static byte[] addShort( byte[] array, short value ); static byte[] insertShortInto( byte[] array, int index, short value ); static void shortTo( byte[] b, int off, short val ); static char idxChar( byte[] b, int off ); static byte[] addChar( byte[] array, char value ); static byte[] insertCharInto( byte[] array, int index, char value ); static void charTo( byte[] b, int off, char val ); static void charTo( byte[] b,  char val ); static float idxFloat( byte[] array, int off ); static byte[] addFloat( byte[] array, float value ); static byte[] insertFloatInto( byte[] array, int index, float value ); static void floatTo( byte[] array, int off, float val ); static byte[] addDouble( byte[] array, double value ); static byte[] insertDoubleInto( byte[] array, int index, double value ); static void doubleTo( byte[] b, int off, double val ); static double idxDouble( byte[] b, int off ); static void _idx( final byte[] array, int startIndex, byte[] input ); static void _idx( final byte[] array, int startIndex, byte[] input, int length ); static void _idx( final byte[] output, int ouputStartIndex, byte[] input, int inputOffset, int length ); static int idxUnsignedShort( byte[] buffer, int off ); static short idxUnsignedByte( byte[] array, int location ); static void unsignedIntTo( byte[] b, int off, long val ); static void unsignedShortTo( byte[] buffer, int off, int value ); static void unsignedByteTo( byte[] buffer, int off, short value ); static String utfString( byte[] jsonBytes ); static int reduceBy( final byte[] array, Object object ); static boolean equalsOrDie(byte[] expected, byte[] got); static boolean equals(byte[] expected, byte[] got); }
Byt { public static byte[] grow( byte[] array, final int size ) { byte[] newArray = new byte[ array.length + size ]; System.arraycopy( array, 0, newArray, 0, array.length ); return newArray; }  static byte[] grow( byte[] array, final int size ); static byte[] grow( byte[] array ); static byte[] shrink( byte[] array, int size ); static byte[] compact( byte[] array ); static byte[] arrayOfByte( final int size ); static byte[] array( final byte... array ); static byte[] bytes( final byte... array ); static byte[] bytes( String str ); static int len( byte[] array ); static int lengthOf( byte[] array ); static byte atIndex( final byte[] array, final int index ); static byte idx( final byte[] array, final int index ); static void atIndex( final byte[] array, int index, byte value ); static void idx( final byte[] array, int index, byte value ); static byte[] sliceOf( byte[] array, int startIndex, int endIndex ); static byte[] slc( byte[] array, int startIndex, int endIndex ); static byte[] sliceOf( byte[] array, int startIndex ); static byte[] slc( byte[] array, int startIndex ); static byte[] endSliceOf( byte[] array, int endIndex ); static byte[] slcEnd( byte[] array, int endIndex ); static boolean in( int value, byte... array ); static boolean inIntArray( byte value, int[] array ); static boolean in( int value, int offset, byte[] array ); static boolean in( int value, int offset, int end, byte[] array ); static byte[] copy( byte[] array ); static byte[] copy( byte[] array, int offset, int length ); static byte[] add( byte[] array, byte v ); static byte[] add( byte[] array, byte[] array2 ); static byte[] insert( final byte[] array, final int idx, final byte v ); static byte[] insert( final byte[] array, final int fromIndex, final byte[] values ); static int idxInt( byte[] bytes, int off ); static byte[] addInt( byte[] array, int v ); static byte[] insertIntInto( byte[] array, int index, int v ); static void intTo( byte[] b, int off, int val ); static void longTo( byte[] b, int off, long val ); static byte[] addLong( byte[] array, long value ); static long idxUnsignedInt( byte[] bytes, int off ); static long idxLong( byte[] b, int off ); static short idxShort( byte[] b, int off ); static byte[] addShort( byte[] array, short value ); static byte[] insertShortInto( byte[] array, int index, short value ); static void shortTo( byte[] b, int off, short val ); static char idxChar( byte[] b, int off ); static byte[] addChar( byte[] array, char value ); static byte[] insertCharInto( byte[] array, int index, char value ); static void charTo( byte[] b, int off, char val ); static void charTo( byte[] b,  char val ); static float idxFloat( byte[] array, int off ); static byte[] addFloat( byte[] array, float value ); static byte[] insertFloatInto( byte[] array, int index, float value ); static void floatTo( byte[] array, int off, float val ); static byte[] addDouble( byte[] array, double value ); static byte[] insertDoubleInto( byte[] array, int index, double value ); static void doubleTo( byte[] b, int off, double val ); static double idxDouble( byte[] b, int off ); static void _idx( final byte[] array, int startIndex, byte[] input ); static void _idx( final byte[] array, int startIndex, byte[] input, int length ); static void _idx( final byte[] output, int ouputStartIndex, byte[] input, int inputOffset, int length ); static int idxUnsignedShort( byte[] buffer, int off ); static short idxUnsignedByte( byte[] array, int location ); static void unsignedIntTo( byte[] b, int off, long val ); static void unsignedShortTo( byte[] buffer, int off, int value ); static void unsignedByteTo( byte[] buffer, int off, short value ); static String utfString( byte[] jsonBytes ); static int reduceBy( final byte[] array, Object object ); static boolean equalsOrDie(byte[] expected, byte[] got); static boolean equals(byte[] expected, byte[] got);  }