System类的两个静态方法currentTimeMillis 和 arraycopy
1 package com.yhqtv.demo02.ThreadPool; 2 3 import java.util.Arrays; 4 5 public class Test { 6 public static void main(String[] args) { 7 //currentTimeMillis方法的使用 8 long start = System.currentTimeMillis(); 9 for (int i = 0; i < 10000; i++) { 10 System.out.println(i+1); 11 } 12 long end = System.currentTimeMillis(); 13 14 System.out.println("打印共耗时"+(end-start)); 15 //--------------------------------------------------- 16 //arraycopy复制数组方法 17 /* src - 源数组。 18 srcPos - 源数组中的起始位置。 19 dest - 目标数组。 20 destPos - 目标数据中的起始位置。 21 length - 要复制的数组元素的数量。 22 23 * */ 24 int[] s={1,2,3,4,5}; 25 int[] s1={1,2,3,4,5,6,7,8,9}; 26 System.out.println("复制前:"+ Arrays.toString(s1)); 27 System.arraycopy(s,1,s1,4,3); 28 System.out.println("复制后:"+ Arrays.toString(s1)); 29 30 } 31 }

个人官网yhqtv.com

浙公网安备 33010602011771号