How to time Java program execution speed
<p>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.</p>

<p>I'm kinda looking for something like:</p>

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

System.out.println("Total execution time: " + totalExecutionTime);
</code></pre>

<p>Thanks</p>
