AddThis Social Bookmark Button

You could be asked to know how long your function runs. Here is few lines to know how.


public static void myFunction(){
// your actual performing code

public static void main(String agrs[]){
long startTime=System.currentTimeMillis();
// now call the target method to test
long endTime=System.currentTimeMillis();
System.out.println("Total time taken to execute myFunction is"+(endTime-startTime)+"in millisec");

It is however very trival way of checking the performance, but works.