Serialize data into one byte array using ByteBuffer
A minor aesthetics advice

You can save some typing by using the method chains over ByteBuffer:

private int getBufferCapacity(final Map&lt;byte[], byte[]&gt; keyDataHolder) {
    int size = 36;
    for (Map.Entry&lt;byte[], byte[]&gt; entry : keyDataHolder.entrySet()) {
        size += 1 + 1 + 8 + 2;
        size += entry.getKey().length;
        size += entry.getValue().length;
    }
    return size;
}

public byte[] serialize2() {
    ByteBuffer byteBuffer = ByteBuffer.allocate(getBufferCapacity(keyDataHolder))
            .order(ByteOrder.BIG_ENDIAN);
    // Use chaining:
    byteBuffer.put(addressedCenter)
            .put(version)
            .putInt(keyDataHolder.size())
            .putInt(getBufferUsed(keyDataHolder))
            .putLong(location)
            .putLong(locationFrom)
            .putLong(locationOrigin)
            .put(partition)
            .put(copy);

    for (Map.Entry&lt;byte[], byte[]&gt; entry : keyDataHolder.entrySet()) {
        byte keyType = 0;
        byte[] key = entry.getKey();
        byte[] value = entry.getValue(); // A map mapping is often called a
        // key/value -pair.
        byte keyLength = (byte) key.length;
        short valueLength = (short) value.length;

        ByteBuffer dataBuffer = ByteBuffer.wrap(value);
        // Short cut:
        long timestamp = valueLength &gt; 10 ? dataBuffer.getLong(2) : 0;

        // Chaining:
        byteBuffer.put(keyType)
                .put(keyLength)
                .put(key)
                .putLong(timestamp)
                .putShort(valueLength)
                .put(value);
    }

    return byteBuffer.array();
}


Also, when you deal with maps, the conventional terminology for a mapping is a key/value-pair. For this reason, I would rewrite

byte[] key = entry.getKey();
byte[] data = entry.getValue();


to

byte[] key = entry.getKey();
byte[] value = entry.getValue();


Then, later on in the code, I would change

byte keyLength = (byte) entry.getKey().length;


with

byte keyLength = key.length;


Instead of

long timestamp = 0;

if (dataSize &gt; 10) {
    timestamp = dataBuffer.getLong(2);              
}   


you can write an one-liner:

long timestamp = valueLength &gt; 10 ? dataBuffer.getLong(2) : 0;


Finally, since you know your file format, you should be able to come up with a function that computes the exact size of the file for particular set of data; call it foo. Now, you would normally do:

ByteBuffer byteBuffer = ByteBuffer.allocate(foo(keyDataHolder));


Hope that helps.