Harry Orson wrote:. . . System.nanoTime();
. . .
milliseconds = duration / 1000000.0 . . .
Use integer arithmetic rather than
doubles. I would prefer a slightly more complicated algorithm that that suggested by
the System class documentation:-
That allows you to estimate and eliminate the time for a
nanoTime() call, but that might be an insignificant duration if
foo() takes a long time. If you prefer milliseconds, don't divide by 1000000, but use
this instead. A millisecond timing will be very inaccurate if
foo() takes a short time to complete.
That is of course a completely different timing from how long it takes Eclipse to run your application.