Compute and display elapsed time of an operation
public class Main { public static void main(String[] args) throws Exception{ long startTime = System.currentTimeMillis(); for (int i = 0; i < 10; i++) { Thread.sleep(60); } long endTime = System.currentTimeMillis(); float seconds = (endTime - startTime) / 1000F; System.out.println(Float.toString(seconds) + " seconds."); } } //0.625 seconds.