base/common/src/main/com/thesett/common/util/ByteBufferUtils.java
public static void write24BitIntToByteArray(byte[] buf, int offset, int value)
    {
        buf[offset++] = (byte) (value & 0x000000ff);
        buf[offset++] = (byte) ((value & 0x0000ff00) >> 8);
        buf[offset] = (byte) ((value & 0x00ff0000) >> 16);
    }
public static void write24BitIntToByteArray(byte[] buf, int offset, int value)
    {
        buf[offset++] = (byte) (value & 0x000000ff);
        buf[offset++] = (byte) ((value & 0x0000ff00) >> 8);
        buf[offset] = (byte) ((value & 0x00ff0000) >> 16);
    }
Outputs an int into a byte array, copying only the bottom 24 bits of the integer. The top, sign bit, is lost by
this operation, so this only works on positive ints below 2^24.

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