Capgemini interview question

Rest API, find prime no code in java