@Override
        public void serialize(final ByteBuffer byteBuffer, final PaddedLong paddedLong) {
            if (paddedLong.padding != padding) {
                throw new IllegalArgumentException(LogUtil.message("Padding mismatch, {} vs {}",
                        padding, paddedLong.padding));
            }
            // Add padding
            for (int i = 0; i < padding; i++) {
                byteBuffer.put((byte) 0);
            }
            byteBuffer.putLong(paddedLong.val);
            byteBuffer.flip();
        }
Borrowed from org.lmdbjava.ByteBufferProxy for testing
stroom-lmdb/src/test/java/stroom/lmdb/TestLmdbJavaComparator.java