Solution to the Knights Tour problem in Java using backtracking