Renumbered Java solutions.