// elapsed time with System.nanoTime // Works only in JDK 1.5+ long start = System.nanoTime(); // .. do something // elapsed time in nanoseconds, billionths of a second long elapsed = System.nanoTime() - start;