Java program to check whether number is prime or not