验证for循环打印数字1-9999所需要使用的时间(毫秒)

 1 package com.yhqtv.demo01.FunctionalInterface;
 2 
 3 
 4 /*
 5  * @author  XMKJ  yhqtv.com Email:[email protected]
 6  * @create 2020-05-23-14:33
 7  *
 8  */
 9 public class Test01 {
10     public static void main(String[] args)  {
11 
12         long start = System.currentTimeMillis();
13         for (int i = 1; i < 10000; i++) {
14             System.out.println(i);
15         }
16         long end = System.currentTimeMillis();
17 
18         System.out.println("打印1-9999需要"+(end-start)+"毫秒");
19 
20     }
21 }