How much time does it take to execute a loop?
<p>Is there any way to know how many seconds does it take a loop to execute in java? </p>

<p>For example:</p>

<pre><code>for(int i=0; i &lt; 1000000; i++) {

//Do some difficult task goes in here

}
</code></pre>

<p>It does not have to be accurate 100%, but its just to have an idea of how long it could take. The algorithm inside is some kind of key generator that writes to a .txt file. I expect it to take even a few mins, so for my first test i want to count the seconds.</p>
