java的byte array如何擴充或相加
多個byte array 要加起來,很簡的作法
import java.io.ByteArrayOutputStream; import java.io.IOException; public class Tester { public static void main(String[] args) throws IOException { byte[] ArrayA = { 1,2,3}; byte[] ArrayB = { 4,5,6}; ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(ArrayA); baos.write(ArrayB); byte[] c = baos.toByteArray(); for(int i=0; i< c.length ; i++) { System.out.print(c[i] +" "); } } }