Maze Traversal in Java