Programs and their solutions in Java