Shut The Box solver in Java