public int compareTo(ByteBuffer value, int offset, int length) {
    // For BC, providing a default implementation here which is doing a bytes copy to a temp byte[]
    // and calling compareTo(byte[]). Make sure to override this method in subclasses to avoid
    // copying bytes unnecessarily.
    byte[] temp = new byte[length];
    ByteBufferUtils.copyFromBufferToArray(temp, value, offset, 0, length);
    return compareTo(temp);
  }
Special compareTo method for subclasses, to avoid copying bytes unnecessarily.
@param value  bytes to compare within a ByteBuffer
@param offset offset into value
@param length number of bytes to compare
@return a negative integer, zero, or a positive integer as this object is less than, equal to,
        or greater than the specified object.
hbase-common/src/main/java/org/apache/hadoop/hbase/filter/ByteArrayComparable.java