I wrote this example code below, and I want the code to check if the condition is true and if it false to wait for a number of minutes to check again if the condition is true and repeat the same process until the condition is true then move on to the other line of code. I don't want the code to execute below code until the condition is true. I know the code is basic but it just an example.
import java.util.concurrent.TimeUnit;
public class Program {
public static void main(String[] args) {
int me = 1;
int you = 19;
int we = 36;
boolean found = false;
while (!found) {
// where to input the TimeUnit for the code to check again if one of the conditions are true so it can move on to the next line of code if there is any?
// TimeUnit.MINUTED.sleep(15);
if(me > you){
System.out.println("I am greater");
found = true;
}
else if(you > we){
System.out.println("(lesser)");
}
else if(we < me){
System.out.println("fine");
}
}
}
}