наноэтат до миллисекунды Java

long startTimer = System.nanoTime(), endTimer;
// Peace of code
endTimer = System.nanoTime();
long duration = endTimer - startTimer;

// Time in MILLISECONDS
duration = TimeUnit.MILLISECONDS.convert(duration, TimeUnit.NANOSECONDS);

// Time in SECONDS
duration = TimeUnit.SECONDS.convert(duration, TimeUnit.NANOSECONDS);

// Time in MICROSECONDS
duration = TimeUnit.MICROSECONDS.convert(duration, TimeUnit.NANOSECONDS);

// Note there are many more conversions avilable
Vishal