Thu Oct 23, 2008 12:52 am
Hi
i have written program for different sorting algorithm each containing
in separate function.
I want to calculate time required to execute each sorting algo. I used
Date class method getTime() to get time before execution & after
execution by creating new object of Date. & Take difference of these two.
But function execute in us & gettime() returns millisecond.
Is there any way to calculate exact time required for each function.
Please explain ur answer
Thu Oct 23, 2008 12:57 am
Before function call:-
- Code:
long startTime = System.currentTimeMillis();
After function call:-
- Code:
long stopTime = System.currentTimeMillis();
System.out.println("Exceution time = " + (stopTime-startTime) );
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.