Check out example codes for "java get excectuon time". It will help you in understanding the concepts better.

Code Example 1

long startTime = System.nanoTime();
methodToTime();
long endTime = System.nanoTime();

long duration = (endTime - startTime);  //divide by 1000000 to get milliseconds.

Learn ReactJs, React Native from akashmittal.com