public static int putLong(ByteBuffer buf, int offset, long val) {
    if (LITTLE_ENDIAN) {
      val = Long.reverseBytes(val);
    }
    if (buf.isDirect()) {
      HBasePlatformDependent.putLong(directBufferAddress(buf) + offset, val);
    } else {
      HBasePlatformDependent.putLong(buf.array(),
        BYTE_ARRAY_BASE_OFFSET + buf.arrayOffset() + offset, val);
    }
    return offset + Bytes.SIZEOF_LONG;
  }
Put a long value out to the specified BB position in big-endian format.
@param buf    the byte buffer
@param offset position in the buffer
@param val    long to write out
@return incremented offset
hbase-common/src/main/java/org/apache/hadoop/hbase/util/UnsafeAccess.java