使用时间
import org.springframework.util.StopWatch;
public class mytest {
private void test() throws InterruptedException {
StopWatch sw = new StopWatch();
sw.start("起床");
Thread.sleep(1000);
sw.stop();
sw.start("洗漱");
Thread.sleep(2000);
sw.stop();
sw.start("锁门");
Thread.sleep(500);
sw.stop();
System.out.println(sw.prettyPrint());
System.out.println(sw.getTotalTimeMillis());
System.out.println(sw.getLastTaskName());
System.out.println(sw.getLastTaskInfo());
System.out.println(sw.getTaskCount());
}
public static void main(String []argv) throws InterruptedException {
mytest testStopWatch = new mytest();
testStopWatch.test();
}
}
逃不过逝水流年 没有时间可以浪费了!!!

浙公网安备 33010602011771号