by @kodeazy
How to check given number is prime or not in java?
 A prime number is a number that is divided by 1 and itself.

Below is an example program on prime number.
class PrimeCheck{ public static void main(String args[]){ int num = 11; for (int index = 2; index <= num / 2; ++index) { if (num % index == 0) { System.out.println("given number is not prime"); return; } } System.out.println("given number is a prime"); return; } }
 12 is divisible by 1,2,3,4,6. so it is not a prime number.

Output:
given number is not prime