Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Clock {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- long startTime = System.currentTimeMillis();
- System.out.println(startTime);
- long elapsedTime = 0;
- for(int i=0; elapsedTime/1000F <= 5;){
- long currentTime = System.currentTimeMillis();
- elapsedTime = currentTime - startTime;
- if(elapsedTime/1000F == (int)(elapsedTime/1000F)){
- System.out.println("Time: " + (elapsedTime/1000F));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement