Best way to Time Execution
I am currently going through an Algorithms and Data Structures Book and have written code for a simple Bubble Sort and Selection Sort. However, I want to see the difference in speeds between the two. Currently, they are both in separate methods and I want to test the speed of the methods itself before I call it till after it returns. What is the best way to do this? I was looking online but realized that using a System call to currentTimeMillis() returned a value of 0 for both. What is the most accurate way to measure execution time? I want to be able to time my code from now on so I need the best way and the most versatile so it works on any occasion.
Thanks so much!:(happy):