I am trying to sort an array using multithreading in java and note its execution time. I am using System.nanoTime() for the same.
Here is a template of the code
start = System.nanoTime();
sort(); // calls different threads to completely sort the array
end = System.nanoTime()
What I want to ask is that the above is in main Thread so will it give me incorrect time results given that I did not put main.sleep() ?? or is it handled by the JVM . Also if I am in need of fast execution is there something that can improve the performance of above code in terms of time execution??