public static int hashCode(ByteBuffer buf, int offset, int length) {
    int hash = 1;
    for (int i = offset; i < offset + length; i++) {
      hash = (31 * hash) + (int) toByte(buf, i);
    }
    return hash;
  }
ByteBuffer to hash offset to start from length to hash
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java