please help me solve this java question on arrays. Thanks Please…