@Test public void testCombine() throws Exception { assertNull(ArraysUtil.combine(null)); assertArrayEquals(new byte[] {}, ArraysUtil.combine(new byte[] {})); assertArrayEquals(new byte[] {1, 3, 2}, ArraysUtil.combine(new byte[] {1, 3, 2}, new byte[] {})); assertArrayEquals(new byte[] {1, 5, 9, 3, 5, 7}, ArraysUtil.combine(new byte[] {1, 5, 9}, new byte[] {3, 5, 7})); assertArrayEquals(new byte[] {1, 3, 2}, ArraysUtil.combine(new byte[] {1, 3, 2})); }
public static byte[] combine(byte[]... bytes) { if (bytes == null) { return null; } else if (bytes.length == 1) { return bytes[0]; } int combinedLength = 0; for (byte[] _bytes : bytes) { if (_bytes != null) { combinedLength += _bytes.length; } } byte[] combined = new byte[combinedLength]; int shift = 0; for (byte[] aByte : bytes) { if (aByte != null) { System.arraycopy(aByte, 0, combined, shift, aByte.length); shift += aByte.length; } } return combined; }
ArraysUtil { public static byte[] combine(byte[]... bytes) { if (bytes == null) { return null; } else if (bytes.length == 1) { return bytes[0]; } int combinedLength = 0; for (byte[] _bytes : bytes) { if (_bytes != null) { combinedLength += _bytes.length; } } byte[] combined = new byte[combinedLength]; int shift = 0; for (byte[] aByte : bytes) { if (aByte != null) { System.arraycopy(aByte, 0, combined, shift, aByte.length); shift += aByte.length; } } return combined; } }
ArraysUtil { public static byte[] combine(byte[]... bytes) { if (bytes == null) { return null; } else if (bytes.length == 1) { return bytes[0]; } int combinedLength = 0; for (byte[] _bytes : bytes) { if (_bytes != null) { combinedLength += _bytes.length; } } byte[] combined = new byte[combinedLength]; int shift = 0; for (byte[] aByte : bytes) { if (aByte != null) { System.arraycopy(aByte, 0, combined, shift, aByte.length); shift += aByte.length; } } return combined; } private  ArraysUtil(); }
ArraysUtil { public static byte[] combine(byte[]... bytes) { if (bytes == null) { return null; } else if (bytes.length == 1) { return bytes[0]; } int combinedLength = 0; for (byte[] _bytes : bytes) { if (_bytes != null) { combinedLength += _bytes.length; } } byte[] combined = new byte[combinedLength]; int shift = 0; for (byte[] aByte : bytes) { if (aByte != null) { System.arraycopy(aByte, 0, combined, shift, aByte.length); shift += aByte.length; } } return combined; } 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[] combine(byte[]... bytes) { if (bytes == null) { return null; } else if (bytes.length == 1) { return bytes[0]; } int combinedLength = 0; for (byte[] _bytes : bytes) { if (_bytes != null) { combinedLength += _bytes.length; } } byte[] combined = new byte[combinedLength]; int shift = 0; for (byte[] aByte : bytes) { if (aByte != null) { System.arraycopy(aByte, 0, combined, shift, aByte.length); shift += aByte.length; } } return combined; } 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);  }