Java implementation of n-queens