Instant before = Instant.now();

/*
do something
*/

Instant after = Instant.now();
Duration duration = Duration.between(before, after);
System.out.println("time = " + duration.toMillis() + " ms");

初窥门径
29 声望3 粉丝

java程序猿