java how to measure the running time of code

www.lautt‮moc.iru‬
java how to measure the running time of code
// import java.time.*;
long start = System.currentTimeMillis();

// code

long time = System.currentTimeMillis() - start;
System.out.println("Duration : " + time);
Created Time:2017-09-27 13:39:48  Author:lautturi