Is there a stopwatch in Java?
You’ll find one in http://commons.apache.org/lang/ It’s called org.apache.commons.lang.time.StopWatch But it roughly does the same as yours. If you’re in for more precision, use System.nanoTime() See also this question here: Time measuring overhead in Java