P84: Simplified Java solution.