What is the easy way to concatenate two byte arrays?
byte
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.
ByteArrayOutputStream
byte a[]; byte b[]; ByteArrayOutputStream outputStream = new ByteArrayOutputStream( ); outputStream.write( a ); outputStream.write( b ); byte c[] = outputStream.toByteArray( );
1.4m articles
1.4m replys
5 comments
56.9k users