The methods of System
and Runtime
class will help you.
Take a look on:
http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html
For example: You can use: System.currentTimeMillis();
which returns the time in millisecond, before and after your program! (at the beginning or end of main
method!)