Order the answer to: (JAVA) Write code that compares the speed of your MyMath.sqrtwith Math.sqrt in the way specified bel

Academic Help net programming Order the answer to: (JAVA) Write code that compares the speed of your MyMath.sqrtwith Math.sqrt in the way specified bel

net programming

Order the answer to: (JAVA) Write code that compares the speed of your MyMath.sqrtwith Math.sqrt in the way specified bel

Question (JAVA) Write code that compares the speed of your MyMath.sqrtwith Math.sqrt in the way specified below. This code should go intothe public static member function named main with return typevoid.
Using a loop, evaluate Math.sqrt on 10, 000, 000 random numbersbetween 0 and 100. These random numbers should be generated bycalling 100*Math.random(). Measure the time it takes to completethis task using System.currentTimeMillis. Do the same withMyMath.sqrt. You may want to consult:https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#currentTimeMillis()
This time measurement includes the time it takes to generate therandom numbers. With a separate loop, measure the time it takes togenerate the random numbers without evaluating the square root.Putting these measurement together, output, to the command line,the average execution time per evaluation of the two square rootfunctions with the execution time of the random number generationsubtracted out.
You will see that Math.sqrt is far superior over MyMath.sqrt.This is to be expected since standard math functions like Math.sqrtare implemented and optimized by a group of experts over manyhours.

Attached

Subject net programming
Ready to try a high quality writing service? Get a discount here