### Question:
ByteBufferUtils { public static boolean arePartsEqual(ByteBuffer buffer, int offsetLeft, int lengthLeft, int offsetRight, int lengthRight) { if (lengthLeft != lengthRight) { return false; } if (buffer.hasArray()) { return 0 == Bytes.compareTo( buffer.array(), buffer.arrayOffset() + offsetLeft, lengthLeft, buffer.array(), buffer.arrayOffset() + offsetRight, lengthRight); } for (int i = 0; i < lengthRight; ++i) { if (buffer.get(offsetLeft + i) != buffer.get(offsetRight + i)) { return false; } } return true; } private  ByteBufferUtils(); static void writeVLong(ByteBuffer out, long i); static long readVLong(ByteBuffer in); static int putCompressedInt(OutputStream out, final int value); static void putInt(OutputStream out, final int value); static void moveBufferToStream(OutputStream out, ByteBuffer in,
      int length); static void copyBufferToStream(OutputStream out, ByteBuffer in,
      int offset, int length); static int putLong(OutputStream out, final long value,
      final int fitInBytes); static int longFitsIn(final long value); static int intFitsIn(final int value); static int readCompressedInt(InputStream input); static int readCompressedInt(ByteBuffer buffer); static long readLong(InputStream in, final int fitInBytes); static long readLong(ByteBuffer in, final int fitInBytes); static void ensureSpace(ByteBuffer out, int length); static void copyFromStreamToBuffer(ByteBuffer out,
      DataInputStream in, int length); static void copyFromBufferToBuffer(ByteBuffer out,
      ByteBuffer in, int sourceOffset, int length); static int findCommonPrefix(ByteBuffer buffer, int offsetLeft,
      int offsetRight, int limit); static int findCommonPrefix(
      byte[] left, int leftOffset, int leftLength,
      byte[] right, int rightOffset, int rightLength); static boolean arePartsEqual(ByteBuffer buffer,
      int offsetLeft, int lengthLeft,
      int offsetRight, int lengthRight); static void skip(ByteBuffer buffer, int length);  }### Answer:
@Test public void testArePartEqual() { byte[] array = new byte[] { 1, 2, 3, 4, 5, 1, 2, 3, 4 }; ByteBuffer buffer = ByteBuffer.wrap(array); assertTrue(ByteBufferUtils.arePartsEqual(buffer, 0, 4, 5, 4)); assertTrue(ByteBufferUtils.arePartsEqual(buffer, 1, 2, 6, 2)); assertFalse(ByteBufferUtils.arePartsEqual(buffer, 1, 2, 6, 3)); assertFalse(ByteBufferUtils.arePartsEqual(buffer, 1, 3, 6, 2)); assertFalse(ByteBufferUtils.arePartsEqual(buffer, 0, 3, 6, 3)); }