Good afternoon Guys (hot sun when i was writing these lines).

I was reading a programming book “Sams Teach Yourself Java in 24 Hours (Covering Java 7 and Android), 6th Edition” (without publicity, an amazing book to buy 🙂 and read B| ) . Anyways, i fell on this algorithm that tests the performance(calculative) of a processor .

Seeming complex, but it’s as simple as thus : making the processor do a simple arithmetic calculation for a period (1 minute for this algorithm) and then counting the number of times(cycle) the processor does this calculation for the given period. Have a clue below :

– (line 5) “* startTime*” : a variable that get’s the current time in milliseconds

– (line 6) “

*” : adds 60 000 milliseconds (1 minute) to the startTime*

**endTime**– (line 8 – 16) here is where the calculations takes place. The Mathematical operation used here is the square root (could be another).

so there’s this integer “** index**” (that arithmetically increments in line 14), for which we cyclically do the square root of , get the time of the square root calculation (in the variable “

*” in line 10), until this time reaches one minute.*

**now**– (line 17) We display the number of loops the processor has done the square root.

The evaluation of the processor speed here is from the fact that a faster processor will do more loops in one minute than a less faster one. I used this to test 3 PCs that was around.

Here is the result of my “not-so-powerful-but-at-least-satisfactory-processor-speed” PC…. 😛 😛

Here’s the line to download the source code above (of the “Benchmark” class)

Thanks for reading 🙂