P433: Fixed and updated Java solution.