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