Optimized algorithm to find all solutions for the N-Queens-Problem in Java