### Question:
ArrayUtils { public static byte[][] split(final byte[] bytes, final 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}; } private  ArrayUtils(); static byte[] duplicate(final byte[] src); static byte[] concat(final byte[]... arrays); static byte[][] split(final byte[] bytes, final int splitIndex); static byte[] toByteArray(final BigInteger value, final int numBytes); static BigInteger toBigInteger(final byte[] bytes); static int isEqualConstantTime(final byte[] b, final byte[] c); static int compare(final byte[] b, final byte[] c); static int getBit(final byte[] h, final int i);  }### Answer:
@Test public void splitFailsIfSplitIndexIsNegative() { final byte[] bytes = new byte[] {7, 13, 12, 4, 6}; Assertions.assertThrows(IllegalArgumentException.class, () -> ArrayUtils.split(bytes, -1)); }
@Test public void splitFailsIfSplitIndexIsGreaterThanInputLength() { final byte[] bytes = new byte[] {7, 13, 12, 4, 6}; Assertions.assertThrows( IllegalArgumentException.class, () -> ArrayUtils.split(bytes, bytes.length + 1)); }
@Test public void canSplitEmptyArray() { final byte[] bytes = new byte[] {}; final byte[][] parts = ArrayUtils.split(bytes, 0); MatcherAssert.assertThat(parts.length, IsEqual.equalTo(2)); MatcherAssert.assertThat(parts[0], IsEqual.equalTo(new byte[] {})); MatcherAssert.assertThat(parts[1], IsEqual.equalTo(new byte[] {})); }
@Test public void canSplitArrayAtBeginning() { final byte[] bytes = new byte[] {12, 4, 6}; final byte[][] parts = ArrayUtils.split(bytes, 0); MatcherAssert.assertThat(parts.length, IsEqual.equalTo(2)); MatcherAssert.assertThat(parts[0], IsEqual.equalTo(new byte[] {})); MatcherAssert.assertThat(parts[1], IsEqual.equalTo(new byte[] {12, 4, 6})); }
@Test public void canSplitArrayAtEnd() { final byte[] bytes = new byte[] {7, 13}; final byte[][] parts = ArrayUtils.split(bytes, 2); MatcherAssert.assertThat(parts.length, IsEqual.equalTo(2)); MatcherAssert.assertThat(parts[0], IsEqual.equalTo(new byte[] {7, 13})); MatcherAssert.assertThat(parts[1], IsEqual.equalTo(new byte[] {})); }
@Test public void canSplitArrayAtMiddle() { final byte[] bytes = new byte[] {7, 13, 12, 4, 6}; final byte[][] parts = ArrayUtils.split(bytes, 2); MatcherAssert.assertThat(parts.length, IsEqual.equalTo(2)); MatcherAssert.assertThat(parts[0], IsEqual.equalTo(new byte[] {7, 13})); MatcherAssert.assertThat(parts[1], IsEqual.equalTo(new byte[] {12, 4, 6})); }