Demo of a logic flow in java