引用
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+"小时");