Tag «execution time»

Easiest Way to calculate elapsed time in Java

Quite often in our day to day programming, we need to compute how long does a specific portion of the code takes to complete. For e.g; you might want to check how long does a method take to complete.  In Java, the simplest way to accomplish this is to use System.nanoTime() method. Following example shows …