代码片断:统计程序执行的时间

引用

double beginTime = System.currentTimeMillis();

//do sth.

double endTime = System.currentTimeMillis();

double second = (endTime – beginTime)/1000;

double minute = second/60;

double hour = minute/60;

System.out.println("总耗时:"+second+"秒,"+minute+"分,"+hour+"小时");

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.