JAVA合并多个byte[]为一个byte[]

private static byte[] byteMergerAll(byte[]... args) {
    int length_byte = 0;
    for (byte[] b : args) {
        length_byte += b.length;
    }
    byte[] all_byte = new byte[length_byte];
    int countLength = 0;
    for (byte[] b : args) {
        System.arraycopy(b, 0, all_byte, countLength, b.length);
        countLength += b.length;
    }
    return all_byte;
}

参考链接:

Java合并多个byte[]为一个byte[]

发表评论