@Test public void success_SplitByteArray_1() { byte[] input1 = new byte[]{19, -16, 82, 23, 24, -5, 62, 17, 82, 3, 67, 121, -16, -83, 14, 25, -13, 37, 13, -19, 20, 21, -82, 3, 94, -5, 26, 57, 18, 91, 110, 78}; byte[] result1 = ArrayUtils.split(input1, 10)[0]; byte[] result2 = ArrayUtils.split(input1, 10)[1]; assertThat(result1, is(new byte[]{19, -16, 82, 23, 24, -5, 62, 17, 82, 3})); assertThat(result2, is(new byte[]{67, 121, -16, -83, 14, 25, -13, 37, 13, -19, 20, 21, -82, 3, 94, -5, 26, 57, 18, 91, 110, 78})); }
public static byte[][] split(byte[] bytes, int splitIndex) { if (splitIndex < 0 || bytes.length < splitIndex) { throw new IllegalArgumentException("split index is out of range"); } final byte[] lhs = new byte[splitIndex]; final byte[] rhs = new byte[bytes.length - splitIndex]; System.arraycopy(bytes, 0, lhs, 0, lhs.length); System.arraycopy(bytes, splitIndex, rhs, 0, rhs.length); return new byte[][]{lhs, rhs}; }
ArrayUtils { public static byte[][] split(byte[] bytes, int splitIndex) { if (splitIndex < 0 || bytes.length < splitIndex) { throw new IllegalArgumentException("split index is out of range"); } final byte[] lhs = new byte[splitIndex]; final byte[] rhs = new byte[bytes.length - splitIndex]; System.arraycopy(bytes, 0, lhs, 0, lhs.length); System.arraycopy(bytes, splitIndex, rhs, 0, rhs.length); return new byte[][]{lhs, rhs}; } }
ArrayUtils { public static byte[][] split(byte[] bytes, int splitIndex) { if (splitIndex < 0 || bytes.length < splitIndex) { throw new IllegalArgumentException("split index is out of range"); } final byte[] lhs = new byte[splitIndex]; final byte[] rhs = new byte[bytes.length - splitIndex]; System.arraycopy(bytes, 0, lhs, 0, lhs.length); System.arraycopy(bytes, splitIndex, rhs, 0, rhs.length); return new byte[][]{lhs, rhs}; }  }
ArrayUtils { public static byte[][] split(byte[] bytes, int splitIndex) { if (splitIndex < 0 || bytes.length < splitIndex) { throw new IllegalArgumentException("split index is out of range"); } final byte[] lhs = new byte[splitIndex]; final byte[] rhs = new byte[bytes.length - splitIndex]; System.arraycopy(bytes, 0, lhs, 0, lhs.length); System.arraycopy(bytes, splitIndex, rhs, 0, rhs.length); return new byte[][]{lhs, rhs}; }  static byte[][] split(byte[] bytes, int splitIndex); static int[] reverse(int[] input); static byte[] toByteArray(BigInteger value, int expectedBytesLength); static int[] toBinaryArray(BigInteger integer); static int[] toMutualOppositeForm(BigInteger integer); }
ArrayUtils { public static byte[][] split(byte[] bytes, int splitIndex) { if (splitIndex < 0 || bytes.length < splitIndex) { throw new IllegalArgumentException("split index is out of range"); } final byte[] lhs = new byte[splitIndex]; final byte[] rhs = new byte[bytes.length - splitIndex]; System.arraycopy(bytes, 0, lhs, 0, lhs.length); System.arraycopy(bytes, splitIndex, rhs, 0, rhs.length); return new byte[][]{lhs, rhs}; }  static byte[][] split(byte[] bytes, int splitIndex); static int[] reverse(int[] input); static byte[] toByteArray(BigInteger value, int expectedBytesLength); static int[] toBinaryArray(BigInteger integer); static int[] toMutualOppositeForm(BigInteger integer);  }