java System
1、获取系统当前的时间(毫秒)
与Date类中getTime()方法相似
package cn.wt.day12; import java.util.Date; public class Demon03 { public static void main(String[] args) { long systemTime = System.currentTimeMillis(); System.out.println(systemTime); Date date = new Date(); System.out.println(date.getTime()); } }
2、数组copy
语法(看源码注释)
arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
src 原数组
srcPos 原数组的index
dest 目标数组
destPos 目标数组的index
length 替换的长度
例子
package cn.wt.day12; import java.util.Arrays; import java.util.Objects; public class Demon03 { public static void main(String[] args) { long currentTime = System.currentTimeMillis(); System.out.println(currentTime); int[] src = {1, 2, 3, 4, 5, 6}; int[] dest = {6, 5, 4, 3, 2, 1}; System.out.println(Arrays.toString(dest)); // [6, 5, 4, 3, 2, 1] System.arraycopy(src, 0, dest, 0, 3); System.out.println(Arrays.toString(dest)); // [1, 2, 3, 3, 2, 1] } }