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