Number of retries = 3 Should complete all the retries under 10 seconds
public class MyClass { public static int attempts = 3; public static void main(String[] args) { // write your code here for (int i=1; i<=attempts; i++) { long start = System.currentTimeMillis(); // do something while(System.currentTimeMillis() - start < 10000) { } if (i == attempts) { System.out.println("Number of retries = " + attempts); System.out.println("Should complete all the retries under 10 seconds"); } } } }