Created
September 5, 2011 04:14
-
-
Save yifanlu/1194078 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Stopwatch { | |
public static void main(String[] args){ | |
long startingTime = System.currentTimeMillis(); | |
long currentTime; | |
long deltaTime = 0; | |
long stopTime = 60 * 1000; // 60 seconds in miliseconds | |
while((currentTime = System.currentTimeMillis()) <= startingTime + stopTime){ | |
deltaTime = currentTime - startingTime; | |
System.out.printf("%d miliseconds passed\n", deltaTime); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment