presto-rcfile/src/main/java/io/prestosql/rcfile/binary/DecimalEncoding.java/DecimalEncoding/writeLong
class DecimalEncoding:    private void writeLong(SliceOutput output, long value)
    {
        // first vint is scale
        writeVInt(output, type.getScale());

        // second vint is length
        int length = getWriteByteCount(value);
        writeVInt(output, length);

        // write value (big endian)
        for (int i = length - 1; i >= 0; i--) {
            output.writeByte((int) (value >> (i * 8)));
        }
    }