33.1k views
4 votes
Use a physical stopwatch to record the length of time it takes to run the program. Calculate the difference obtained by calls to the method System.currentTimeMillis() just before the start of the algorithm and just after the end of the algorithm. Calculate the difference obtained by calls to the method System.currentTimeMillis() at the start of the program and at the end of the program so that the elapsed time includes the display of the result. Use the value returned by the method System.currentTimeMillis() just after the end of the algorithm as the elapsed time.

1 Answer

6 votes

Answer:

Calculating the Elapsed Running time of algorithm , we put System.currentTimeMillis() at the start of main method and at the end of main Method and calculate the difference.

long end = System.currentTmeMillies();

------Program -------

long end = System.currentTmeMillies();

long elapsedTime = end-start

Step-by-step explanation:

User Tas
by
4.7k points