Solve Java code challenges.