P401: Added Java solution.