Primes { public static boolean isPrime(int n) { if (n < 2) { return false; } for (int p : SmallPrimes.PRIMES) { if (0 == (n % p)) { return n == p; } } return SmallPrimes.millerRabinPrimeTest(n); } private  Primes(); static boolean isPrime(int n); static int nextPrime(int n); static List<Integer> primeFactors(int n);  }
@Test public void testIsPrime() throws Exception { for (int i : BELOW_2) { Assert.assertFalse(Primes.isPrime(i)); } for (int i:NOT_PRIMES) { Assert.assertFalse(Primes.isPrime(i)); } for (int i:PRIMES) { Assert.assertTrue(Primes.isPrime(i)); } }