added reallocation for java byte array