Java程序运行时间计时代码

来源:互联网 发布:中国历年gdp数据查询 编辑:程序博客网 时间:2024/04/30 12:59

package com.writchie;

import java.util.Date;

public class Timer {

/**
* @author   writchie

*/
public static void main(String[] args) {

   long startTime = new Date().getTime();
/*

程序代码

*/

   long endTime = new Date().getTime();
   System.out.println("本程序运行 " + (endTime - startTime)
                 + " 毫秒完成。" );

}

}

原创粉丝点击