cin_ie 发表于 2013-1-19 04:13:58

java 数组合并

public static void main(String[] args) {    byte[] src1 = {a,b,c}    byte[] src2 = {1,2,3,4}    byte[] target = new byte;    int len = src1.length + src2.length;    System.arraycopy(src1, 0, target, 0, src1.length);    System.arraycopy(src2, 0, target, src1.length, src2.length);}

System.arraycopy(src, srcOffset, tar, tarOffset, length)

src : 源数组
srcOffset:源数组中的需要复制的偏移量

tar:目标数组
tarOffset:目标数组中需要复制到的偏移量

length:需要复制源数组的长度
页: [1]
查看完整版本: java 数组合并