不多说直接上代码:
public class Demo {
public static void main(String[] args) {
int[] array1 = {1,2,3,4,5,6,7};
int[] array2 = {6,7,8};
/*第一个参数是要拷贝的数组
*要拷贝数组的索引位置
*目标数组
*目标数组的起始索引位置
*要拷贝的长度
*/
System.arraycopy(array2,0,array1,0,3);//只是替换,不可能插入
for(int i=0;i<array1.length;i++){
System.out.print(array1[i]);
}
//获的当前时间的毫秒数,从1970年开始
long ti = System.currentTimeMillis();
System.out.println(ti);
//垃圾回收机制
System.gc();
//返回当前系统属性集合
String ss = System.getProperty("os.name");
System.out.println(ss);//返回操作系统版本 如Windows 10
String ss1 = System.getProperty("java.version");
System.out.println(ss1);//返回java 的版本
}
}