@Test public void testReadBytes() throws Exception { assertArrayEquals(new byte[] {10, 4, -89, -24}, ArraysUtil.readBytes(new byte[] {10, 4, -89, -24}, 0)); assertArrayEquals(new byte[] {-89, -24}, ArraysUtil.readBytes(new byte[] {10, 4, -89, -24}, 2)); assertArrayEquals(new byte[] {}, ArraysUtil.readBytes(new byte[] {10, 4, -89, -24}, 4)); assertArrayEquals(new byte[] {10}, ArraysUtil.readBytes(new byte[] {10, 4, -89, -24}, 0, 1)); assertArrayEquals(new byte[] {-89, -24}, ArraysUtil.readBytes(new byte[] {10, 4, -89, -24}, 2, 2)); assertArrayEquals(new byte[] {10, 4, -89, -24}, ArraysUtil.readBytes(new byte[] {10, 4, -89, -24}, 0, 4)); assertArrayEquals(new byte[] {}, ArraysUtil.readBytes(new byte[] {}, 0, 4)); assertArrayEquals(new byte[] {}, ArraysUtil.readBytes(null, 0, 4)); }
public static byte[] readBytes(byte[] source, int start) { if (source == null || source.length == 0) { return new byte[0]; } byte[] result = new byte[source.length - start]; System.arraycopy(source, start, result, 0, source.length - start); return result; }
ArraysUtil { public static byte[] readBytes(byte[] source, int start) { if (source == null || source.length == 0) { return new byte[0]; } byte[] result = new byte[source.length - start]; System.arraycopy(source, start, result, 0, source.length - start); return result; } }
ArraysUtil { public static byte[] readBytes(byte[] source, int start) { if (source == null || source.length == 0) { return new byte[0]; } byte[] result = new byte[source.length - start]; System.arraycopy(source, start, result, 0, source.length - start); return result; } private  ArraysUtil(); }
ArraysUtil { public static byte[] readBytes(byte[] source, int start) { if (source == null || source.length == 0) { return new byte[0]; } byte[] result = new byte[source.length - start]; System.arraycopy(source, start, result, 0, source.length - start); return result; } private  ArraysUtil(); static BitSet getBitAddress(String ip); static int bytes2int(byte[] bytes); static byte[] combine(byte[]... bytes); static byte convertBits(Boolean... bits); static byte[] copy(byte[] source); static int getBit(byte _byte, int position); static byte[] int2bytes(int value); static byte[] int2bytesCropp(int value, int nbytes2cropp); static byte[] readBytes(byte[] source, int start); static byte[] readBytes(byte[] source, int start, int length); static byte reverseBitsByte(byte x); static byte setBit(byte _byte, int position, boolean value); }
ArraysUtil { public static byte[] readBytes(byte[] source, int start) { if (source == null || source.length == 0) { return new byte[0]; } byte[] result = new byte[source.length - start]; System.arraycopy(source, start, result, 0, source.length - start); return result; } private  ArraysUtil(); static BitSet getBitAddress(String ip); static int bytes2int(byte[] bytes); static byte[] combine(byte[]... bytes); static byte convertBits(Boolean... bits); static byte[] copy(byte[] source); static int getBit(byte _byte, int position); static byte[] int2bytes(int value); static byte[] int2bytesCropp(int value, int nbytes2cropp); static byte[] readBytes(byte[] source, int start); static byte[] readBytes(byte[] source, int start, int length); static byte reverseBitsByte(byte x); static byte setBit(byte _byte, int position, boolean value);  }