What is the easy way to concatenate two byte arrays?
Say,
byte a[];
byte b[];
How do I concatenate two byte
Here's a nice solution using Guava's com.google.common.primitives.Bytes:
byte[] c = Bytes.concat(a, b);
The great thing about this method is that it has a varargs signature:
public static byte[] concat(byte[]... arrays)
which means that you can concatenate an arbitrary number of arrays in a single method call.