Mars Rover problem in Java