How do I get a method's execution time? Is there a Timer utility class for things like timing how long a task takes, etc?
Most of the searches on Google return results for timers that schedule threads and tasks, which is not what I want.
long startTime = System.nanoTime();
long endTime = System.nanoTime();
long duration = (endTime - startTime);