java 常用API 包装 数组的覆盖和遍历

package com.oracel.demo01;

public class Sz {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		menthod();
	}
    public static void menthod(){
    	//原数组
    	int[] arr={3,6,8,9,4,5};
    	//目标数组
    	int[] arr2=new int[3];
    	//原来要是有数的话会覆盖
    	//原数组,第几位,目标数组,第几位,一共复制多少位
    	System.arraycopy(arr, 3, arr2, 0, 3);
    	for(int i:arr2){
    		System.out.println(i);
    		System.gc();
    	}
    }
}

猜你喜欢

转载自www.cnblogs.com/hankai2735/p/9092312.html
今日推荐