@Override
    public byte[] toBytes(final long val) {
        if (len == 0 && val == 0) {
            return ZERO_BYTES;
        } else if (len < 1) {
            throw new IllegalArgumentException("You cannot use less than 1 byte to store a value.");
        } else if (val == 0) {
            return new byte[len];
        } else {
            final byte[] bytes = new byte[len];
            put(bytes, 0, val);
            return bytes;
        }
    }
Each instance provides methods for working with unsigned longs that are written
to len bytes. The maximum numeric value of the unsigned value will be governed
by len, e.g for len == 1, the range of values are 0-255.
stroom-lmdb/src/main/java/stroom/lmdb/serde/UnsignedBytesInstances.java