@@ -0,0 +1,705 @@
+package java_problems.beginner;%0D%0A%0D%0Aimport java.util.Scanner;%0D%0A%0D%0Apublic class PrimalityTest %7B%0D%0A%0D%0A%09public static void main(String%5B%5D args) %7B%0D%0A%09%09%0D%0A%09%09Scanner sc = new Scanner(System.in);%0D%0A%09%09int numCases = Integer.parseInt(sc.nextLine());%0D%0A%09%09for (int i = 0; i %3C numCases; i++) %7B%0D%0A%09%09%09if (isPrime(sc.nextInt())) %7B%0D%0A%09%09%09%09System.out.println(%22yes%22);%0D%0A%09%09%09%7D else %7B%0D%0A%09%09%09%09System.out.println(%22no%22);%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09sc.close();%0D%0A%09%7D%0D%0A%09%0D%0A%09private static boolean isPrime(int n) %7B%0D%0A%09%09if (n == 2) %7B%0D%0A%09%09%09return true;%0D%0A%09%09%7D else if (n %3C= 1 %7C%7C n %25 2 == 0) %7B%0D%0A%09%09%09return false;%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09long max = (long) Math.sqrt(n);%0D%0A%09%09for (long i = 3; i %3C= max; i += 2) %7B%0D%0A%09%09%09if (n %25 i == 0) %7B%0D%0A%09%09%09%09return false;%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09return true;%0D%0A%09%7D%0D%0A%7D

Add PrimalityTest