1、Stopwatch watch = Stopwatch.createStarted();
watch.stop();
"耗时:"+watch.elapsed().toMillis()

2、
Instant beginTime = Instant.now();

Instant endTime = Instant.now();

耗时:Duration.between(beginTime, endTime).toMillis() + "ms"

3、long start = System.currentTimeMillis();
long end = System.currentTimeMillis();

耗时: (end - start) ms
 posted on 2019-01-18 11:14  sunnyBalckCat  阅读(218)  评论(0编辑  收藏  举报