Java code to generate and solve mazes