java System.arraycopy 数组复制和合并

 

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);
         }
    }
}

 

posted @ 2016-11-28 09:34  N神3  阅读(1308)  评论(0编辑  收藏  举报