Finding how much time does a function run in Java
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/180158/how-do-i-time-a-methods-execution-in-java">How do I time a method&#39;s execution in Java?</a>  </p>
</blockquote>



<p>I would like to know what the code would be to find how much time a function takes to execute till its last statement starting from the first.Suppose my function is like this:</p>

<pre><code>public void sum(int a,int b)
{
    int c;
    c=a+b;
    System.out.print(c);
}
</code></pre>

<p>Please insert the necessary code into the above function itself. Will be very helpful.</p>
