Update simulator.java

Final version