Euler triangle puzzle implemented in Java