标签:java
JAVA问题总结之14-程序运行时间得测量代码:
package java2; public class test6 { public static void main(String[] args){ long start=System.currentTimeMillis(); for (int i=1;i<=100000;i++){ System.out.println(i); } long time=System.currentTimeMillis()-start; double stime=(double) time / 1000; System.out.println("time is "+stime+"s"); } }
......//省略n个 99998 99999 100000 time is 2.583s
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:java
原文地址:http://blog.csdn.net/xubo245/article/details/48010479