P451: Added Java solution.