Code example for Stopwatch

0
 * 
 * @author Samuel Gratzl 
 * 
 */ 
public class TimeDelta { 
	private final Stopwatch stopWatch = new Stopwatch();
 
	/** 
	 * return the time between the last call and the current one, reset the timer 
	 *  
	 * @return 
	 */ 
	public int getDeltaTimeMs() { 
		int deltaTimeMs = 0;
		if (stopWatch.isRunning()) {
			deltaTimeMs = (int) stopWatch.elapsedMillis();
			stopWatch.reset().start();
		} else { 
			stopWatch.start();
		}