@Test public void testConcat() { final byte[] left = randomUUID().toString().getBytes(); final byte[] right = randomUUID().toString().getBytes(); final byte[] concated = new byte[left.length + right.length]; System.arraycopy(left, 0, concated, 0, left.length); System.arraycopy(right, 0, concated, left.length, right.length); assertTrue(Arrays.equals(left, ArrayUtils.concat(left, null))); assertTrue(Arrays.equals(right, ArrayUtils.concat(null, right))); }
public static byte[] concat(final byte[] left, final byte[] right) { if (null == left && null == right) { return new byte[0]; } if (null == left) { return Arrays.copyOf(right, right.length); } if (null == right) { return Arrays.copyOf(left, left.length); } final byte[] concated = new byte[left.length + right.length]; System.arraycopy(left, 0, concated, 0, left.length); System.arraycopy(right, 0, concated, left.length, right.length); return concated; }
ArrayUtils { public static byte[] concat(final byte[] left, final byte[] right) { if (null == left && null == right) { return new byte[0]; } if (null == left) { return Arrays.copyOf(right, right.length); } if (null == right) { return Arrays.copyOf(left, left.length); } final byte[] concated = new byte[left.length + right.length]; System.arraycopy(left, 0, concated, 0, left.length); System.arraycopy(right, 0, concated, left.length, right.length); return concated; } }
ArrayUtils { public static byte[] concat(final byte[] left, final byte[] right) { if (null == left && null == right) { return new byte[0]; } if (null == left) { return Arrays.copyOf(right, right.length); } if (null == right) { return Arrays.copyOf(left, left.length); } final byte[] concated = new byte[left.length + right.length]; System.arraycopy(left, 0, concated, 0, left.length); System.arraycopy(right, 0, concated, left.length, right.length); return concated; }  }
ArrayUtils { public static byte[] concat(final byte[] left, final byte[] right) { if (null == left && null == right) { return new byte[0]; } if (null == left) { return Arrays.copyOf(right, right.length); } if (null == right) { return Arrays.copyOf(left, left.length); } final byte[] concated = new byte[left.length + right.length]; System.arraycopy(left, 0, concated, 0, left.length); System.arraycopy(right, 0, concated, left.length, right.length); return concated; }  static boolean isEmpty(final T[] arrays); static int length(
      final T[] arrays); static byte[] concat(final byte[] left, final byte[] right); }
ArrayUtils { public static byte[] concat(final byte[] left, final byte[] right) { if (null == left && null == right) { return new byte[0]; } if (null == left) { return Arrays.copyOf(right, right.length); } if (null == right) { return Arrays.copyOf(left, left.length); } final byte[] concated = new byte[left.length + right.length]; System.arraycopy(left, 0, concated, 0, left.length); System.arraycopy(right, 0, concated, left.length, right.length); return concated; }  static boolean isEmpty(final T[] arrays); static int length(
      final T[] arrays); static byte[] concat(final byte[] left, final byte[] right);  }