Create Stopwatch class with start, stop and deference methods - It is use for find out the execution time of any process explicitly public class StopWatch { long start = System.currentTimeMillis(); long stop = 0; String title = null; public StopWatch( String title ) { this.title = title; } public long start() { start = System.currentTimeMillis(); stop = 0; return start; } public long stop() { stop = System.currentTimeMillis(); return stop; } public long diff() { if ( stop == 0 ) { return ( System.currentTimeMillis() - start ); } return ( stop - start ); } public static void main( String[] args ) { StopWatch stopWatch = new StopWatch( "My Stop watch" ); System.out.println( "Start : " + stopWatch.start() ); System.out.println( "stop : " + stopWatch.stop() ); System