public class TimerDriver
{
public static void main( String args[] )
{
Stopwatch seiko = new Stopwatch();
seiko.startTimer();
for(int ctr = 0; ctr <
Integer.MAX_VALUE; ctr++)
{
// what do you
want to time??
// do nothing
}
seiko.endTimer();
seiko.printElapsedTime();
} // end method main
} // end class TimerDriver
public class Stopwatch
{
private long startTime;
private long endTime;
public Stopwatch()
{
startTime = 0;
endTime = 0;
}
public void startTimer()
{
startTime = System.currentTimeMillis();
}
public void endTimer()
{
endTime = System.currentTimeMillis();
}
public void printElapsedTime()
{
System.out.println( "Elapsed time in
ms is: " + (endTime - startTime) );
}
} // end class Stopwatch