Clean up Java implementation for problem 2 by removing unused variable.