public static byte[] getOptimizedByteArrayForEventID(long threadId, long sequenceId) {

    int threadIdLength = getByteSizeForValue(threadId);
    int threadIdIndex = (threadIdLength == 1) ? 0 : ((threadIdLength / 4) + 1);

    int sequenceIdLength = getByteSizeForValue(sequenceId);
    int sequenceIdIndex = (sequenceIdLength == 1) ? 0 : ((sequenceIdLength / 4) + 1);

    int byteBufferLength = 2 + threadIdLength + sequenceIdLength;
    ByteBuffer buffer = ByteBuffer.allocate(byteBufferLength);
    fillerArray.get(threadIdIndex).fill(buffer, threadId);
    fillerArray.get(sequenceIdIndex).fill(buffer, sequenceId);
    return buffer.array();

  }
Gets the optimized byte-array representation of an eventId which can be sent across the
network.
For client to server messages, the membership id part of event-id is not need to be sent with
each event. Also, the threadId and sequenceId need not be sent as long if their value is small.
This function returns the optimal byte-array for the eventId.
<p>
This is public for unit testing purposes only

@param threadId - the long value of threadId
@param sequenceId - the long value of sequenceId
@return - the optimized byte-array representing the eventId
geode-core/src/main/java/org/apache/geode/internal/cache/EventID.java