What is the easy way to concatenate two byte
arrays?
Say,
byte a[];
byte b[];
How do I concatenate two byte
arrays and store it in another byte
array?
The most elegant way to do this is with a ByteArrayOutputStream
.
byte a[];
byte b[];
ByteArrayOutputStream outputStream = new ByteArrayOutputStream( );
outputStream.write( a );
outputStream.write( b );
byte c[] = outputStream.toByteArray( );