Actually if you are doing this, why don't you just write directly to the bytes array instead of creating a new byte array?