Turing machine simulated in java