### Question:
ByteUtil { public static byte[][] split(byte[] source, byte[] separator) { return split(source, separator, -1); }  static byte[][] split(byte[] source, byte[] separator); static byte[][] split(byte[] source, byte[] separator, int limit); static List<Range> splitRanges(byte[] source, byte[] separator); static List<Range> splitRanges(byte[] source, byte[] separator, int limit); static byte[] join(byte[] separator, byte[]... components); static int indexOf(byte[] array, byte[] target, int fromIndex); static byte[] safeCopy(byte[] source, int offset, int length); static long getValueAsLong(final byte[] key,
      final Map<byte[], byte[]> taskValues); static String getValueAsString(final byte[] key,
      final Map<byte[], byte[]> taskValues); static double getValueAsDouble(byte[] key,
      NavigableMap<byte[], byte[]> infoValues); static int getValueAsInt(byte[] key, Map<byte[], byte[]> infoValues);  }### Answer:
@Test public void testSplit() { byte[][] expected1 = Bytes .toByteArrays(new String[] { "abc", "bcd", "cde" }); byte[][] splitresult = ByteUtil.split(source1, sep1); assertSplitResult(expected1, splitresult); byte[][] expected2 = Bytes.toByteArrays(new String[] { "random", "stuff", "" }); splitresult = ByteUtil.split(source2, sep2); assertSplitResult(expected2, splitresult); byte[][] expected3 = Bytes.toByteArrays(new String[] { "", "more", "stuff", "" }); splitresult = ByteUtil.split(source3, sep3); assertSplitResult(expected3, splitresult); byte[][] expected4 = Bytes.toByteArrays(new String[] { "singlesource" }); splitresult = ByteUtil.split(source4, sep4); assertSplitResult(expected4, splitresult); byte[][] expected5 = Bytes.toByteArrays(new String[]{ "abc", "", "bcd"}); splitresult = ByteUtil.split(source5, sep5); assertSplitResult(expected5, splitresult); byte[][] expected6 = new byte[][] {source6}; splitresult = ByteUtil.split(source6, sep6); assertSplitResult(expected6, splitresult); }
@Test public void testSplitWithLimit() { byte[][] expectedResult = Bytes.toByteArrays(new String[] {"random", "stuff::"}); byte[][] splitResult = ByteUtil.split(source2, sep2, 2); assertSplitResult(expectedResult, splitResult); expectedResult = Bytes.toByteArrays(new String[] {"random", "stuff", ""}); splitResult = ByteUtil.split(source2, sep2, 100); assertSplitResult(expectedResult, splitResult); expectedResult = new byte[][] {source2}; splitResult = ByteUtil.split(source2, sep2, 1); assertSplitResult(expectedResult, splitResult); }