Putting a timer in a program to say how long it took - Java
<p>Just out of interest, it would be nice to know how long my calculation programs run (e.g. Project Euler solutions). Either to see how many milliseconds I can squeeze out of the time by using different solutions, or to see how long it takes to crunch big numbers. Usually such a program ends with a <code>System.out.println</code>, printing the answer. How can I put in another <code>println</code>, which says "The program took  seconds", or something like that (i.e. increment some variable by 0.001 every millisecond, then print it when the program is done)?</p>
