Mega Code Archive

 
Categories / Java Tutorial / Development
 

Calculate process elapsed time

public class Main {   public static void main(String[] args) {     long start = System.nanoTime();     System.out.println("Start: " + start);     for (int i = 0; i < 100; i++) {       for (int j = 0; j < 100; j++) {         System.out.println("asdf");       }     }     long end = System.nanoTime();     System.out.println("End  : " + end);     long elapsedTime = end - start;     System.out.println(elapsedTime + " nano seconds");   } }