Well, you can use
long startTime = System.nanoTime();
// ... the code being measured ...
long estimatedTime = System.nanoTime() - startTime;
if you really think you need better than millisecond resolution.
Ezzaral
Posting Genius
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
For measuring the relative execution times of alternate implementations, consider turning off the HotSpot compiler, using java -Xint . This will ensure a uniform environment for the entire duration of a program.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439