Loading

System.arraycopy用法

System.arraycopy用法

注意长度的设置;

public class ArrCopy {
    public static void main(String[] args) {
        int [] src = {1,2,3,4,5,6,7,8,9,10};
        int [] src2 = {1,2,3,4,5,6,7,8,9,10};
        int [] dest = new int[20];
        System.arraycopy(src, 0, dest, 0, 10);
        System.arraycopy(src2, 0, dest, 10, 10);
        System.out.println(Arrays.toString(dest));
    }
}

 

posted @ 2017-05-18 11:35  stono  阅读(230)  评论(0编辑  收藏  举报