question: void ensureCapacity ( final int bytesAmount ) { if ( currentByteArrayIndex + bytesAmount >= serializedData . length ) { int newSerializedDataArrayLength = ( serializedData . length + 1 ) * 2 ; while ( currentByteArrayIndex + bytesAmount >= newSerializedDataArrayLength ) { newSerializedDataArrayLength = newSerializedDataArrayLength * 2 ; } final byte [ ] newSerializedDataArray = new byte [ newSerializedDataArrayLength ] ; System . arraycopy ( serializedData , 0 , newSerializedDataArray , 0 , currentByteArrayIndex ) ; serializedData = newSerializedDataArray ; } }
target:  Resizes original byte array if the object turns out to be bigger than expected.