i have used time of execution class to know the time of execution of the operation,but upon running the program different times it gives different time of execution,can any one tell why it is happening or anyother way to get the time of execution
thanks for support
Joined: Aug 05, 2005
How big a difference are you seeing in the times ? No program will have the same execution time every time it runs.
Note that the accuracy of the timer used by System.currentTimeMillis() is not very good on some operating systems. So if you time very short events, you will not get very accurate time measurements if you use this.
If you're using Java 5 or newer, you could use System.nanoTime() instead, which will probably use a more accurate timer, but even that timer does not have a guaranteed accuracy.