关于统计统计程序运行时间的问题

来源:互联网 发布:php 判断微信 编辑:程序博客网 时间:2024/06/07 01:32

//关于统计统计程序运行时间的问题
public class C {
 public static void main(String []args) {
  Long startTime = System.currentTimeMillis();
  System.out.println("程序开始运行计算机当前毫秒数 " + startTime);
    for(int i=0;i<=10;i++){
     System.out.println("**************************");
    }
  Long endTime = System.currentTimeMillis();
  System.out.println("程序运行到此处计算机当前毫秒数 " + startTime);
  System.out.println("程序共计运行 "+ (endTime-startTime)+" 毫秒");
 }
}

 

 

------------------------------------------------------------------------------------------------------------------

C:/>javac C.java

C:/>java C
程序开始运行计算机当前毫秒数 1236088882882
**************************
**************************
**************************
**************************
**************************
**************************
**************************
**************************
**************************
**************************
**************************
程序运行到此处计算机当前毫秒数 1236088882882
程序共计运行 16 毫秒

原创粉丝点击