What is the best way to implement the following pseudo-code in java?
method_one():
while(condition_one):
EXECUTE method_two(); // (A)
method_two():
while(condition_two):
EXECUTE method_three(); // (B)
method_three():
if (condition_three):
GOTO EXECUTE method_two();
else:
//do some stuff
Edit: Thanks for prompt replies, everybody. Helped a lot. Figured it out now.
condition_onebe true whencondition_threeis true inmethod_three? If so, you can just callmethod_oneinstead of agoto. I believe Java doesn't have tail call elimination, so you can't do that too often. Do you need three separate methods for the loops? It might be easier to write a single state machine in a single method that does the same logic.GOTO EXECUTE method_two();andEXECUTE method_two()?