1 import java.util.Scanner; 2 3 public class Solution 4 { 5 public static void main(String[] args) 6 { 7 Scanner input = new Scanner(System.in); 8 System.out.print("Enter the number of second: "); 9 int countDown = input.nextInt(); 10 11 input.close(); 12 13 long startTime = System.currentTimeMillis(); 14 long nowTime; 15 for(int i = countDown; i > 0; i--) 16 { 17 System.out.println(i + " seconds remaining"); 18 nowTime = System.currentTimeMillis(); 19 while(nowTime - startTime < 1000) 20 nowTime = System.currentTimeMillis(); 21 startTime = System.currentTimeMillis(); 22 } 23 24 System.out.println("Stopped"); 25 } 26 }