您的位置:首页 > 编程语言 > Java开发

java System.arraycopy 数组复制和合并

2016-11-28 09:34 381 查看
public class Test {
public static void main(String[] args)  {
Integer[] a = {1,2,3};
Integer[] b = {4,5,6};
Integer[] c = new Integer[a.length+b.length];
System.arraycopy(a, 0, c, 0, a.length);
System.arraycopy(b, 0, c, b.length, b.length);
for(Integer i : c){
System.out.println(i);
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: