Testing Your Computer Speed
This hour’s workshop is a Java program that performs a benchmark, a test that measures how fast computer hardware or software is operating. The
Benchmark program uses a loop statement to repeatedly perform the following mathematical expression:
double x = Math.sqrt(index);
The benchmark you’re creating sees how many times a Java program can calculate a square root in one minute.
Use NetBeans to create a new empty Java file called
Benchmark. Enter the text of Listing 8.2 and save the program when you’re done.