Prime Number Program in Java

What is a Prime Number?

A prime number is a positive integer that has exactly two positive integer factors, 1 and itself . Another way of saying this is that a prime number is a positive integer that is not the product of two smaller positive integers.
Java prime number
Here is a list of all the prime numbers up to 100 :
  1. 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97
import java.util.Scanner; public class test { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter the number :"); int i = scan.nextInt(); scan.close(); isPrime(i); } private static void isPrime(int inNum) { if (inNum == 0 inNum == 1) { System.out.println(inNum + " is not a prime number !!"); return; } if (inNum == 2) { System.out.println(inNum + " is a prime number !!"); return; } for (int i = 2; i <= inNum / 2; i++) { if (inNum % i == 0) { System.out.println(inNum + " is not a prime number !!"); return; } } System.out.println(inNum + " is a prime number !!"); } }