public static byte[] concat(final byte[] b1, final byte[] b2) {
        if (b1 == null) {
            throw new NullPointerException("b1");
        }
        if (b2 == null) {
            throw new NullPointerException("b2");
        }
        final byte[] result = new byte[b1.length + b2.length];

        System.arraycopy(b1, 0, result, 0, b1.length);
        System.arraycopy(b2, 0, result, b1.length, b2.length);

        return result;
    }
copy google protocol buffer
https://github.com/google/protobuf/blob/master/java/src/main/java/com/google/protobuf/CodedOutputStream.java
commons/src/main/java/com/navercorp/pinpoint/common/util/BytesUtils.java