base/common/src/main/com/thesett/common/util/ByteBufferUtils.java
public static void writeShortToByteArray(byte[] buf, int offset, short value)
    {
        buf[offset++] = (byte) (value & 0x000000ff);
        buf[offset] = (byte) ((value & 0x0000ff00) >> 8);
    }
public static void writeShortToByteArray(byte[] buf, int offset, short value)
    {
        buf[offset++] = (byte) (value & 0x000000ff);
        buf[offset] = (byte) ((value & 0x0000ff00) >> 8);
    }
Outputs a short into a byte array.

@param buf    The byte array to write to.
@param offset The offset within the byte array to output the short.
@param value  The short value to write into the array.