Cognizant interview question

String reverse in Java, Prime numbers in Java