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