code: public byte[] serialize() {
          if (currentByteArrayIndex == 0) {
              return new byte[0];
          }
          final byte[] extractedSerializedData = new byte[currentByteArrayIndex];
          System.arraycopy(serializedData, 0, extractedSerializedData, 0, currentByteArrayIndex);
          return extractedSerializedData;
      }
docs: Finishes serialization, returning the object as a byte array.
  
  @return serialized object as byte array.