How to time Java program execution speed

Posted by George Mic on Stack Overflow See other posts from Stack Overflow or by George Mic
Published on 2010-04-03T22:24:20Z Indexed on 2010/04/03 22:33 UTC
Read the original article Hit count: 211

Filed under:

Sorry if this sounds like a dumb question but how do you time the execution of a java program? I'm not sure what class I should use to do this.

I'm kinda looking for something like:

//Some timer starts here
for (int i = 0; i < length; i++) {
  // Do something
}
//End timer here

System.out.println("Total execution time: " + totalExecutionTime);

Thanks

© Stack Overflow or respective owner

Related posts about java