private static void putInt(final MappedByteBuffer buffer, final int index, final int n) {
        byte[] bs = new byte[RECORD_DATA_LENGTH_SIZE];
        Bits.putInt(bs, 0, n);
        for (int i = 0; i < bs.length; i++) {
            buffer.put(index + i, bs[i]);
        }
    }
Write the data and return it's wrote position.

@param logIndex the log index
@param data     data to write
@return the wrote position
jraft-core/src/main/java/com/alipay/sofa/jraft/storage/log/SegmentFile.java