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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

鑫淼的世界   2020-05-23 我要评论
 1 package com.yhqtv.demo01.FunctionalInterface;
 2 
 3 
 4 /*
 5  * @author  XMKJ  yhqtv.com Email:yhqtv@qq.com
 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 }

 

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们