I had one idea and to implement it I need your help. Is it possible in the loop, for, while, do while, does not matter, write code that will be executed only once, that is:
boolean variable = false; for (int i;i==10;i++) { System.out.println("OK"); if (i==5) { variable = true; } if (variable==true) { System.out.println(variable); } } How to make the if executed only 1 time, and not run more in a loop to get the most optimization.