Puzzles solved in java