RandomUtils { public static boolean isNotPrime(int n) { if (n < 2 || (n & 0x1) == 0) { return n != 2; } int max = 1 + (int) Math.sqrt(n); for (int d = 3; d <= max; d += 2) { if (n % d == 0) { return true; } } return false; } private  RandomUtils(); static void useTestSeed(); static Random getRandom(); static Random getRandom(long seed); static byte[] longSeedtoBytes(long seed); static long seedBytesToLong(byte[] seed); static int hashDouble(double value); static int hashFloat(float value); static int nextTwinPrime(int n); static int nextPrime(int n); static boolean isNotPrime(int n); static final int MAX_INT_SMALLER_TWIN_PRIME; }
@Test public void testIsNotPrime() { assertTrue(RandomUtils.isNotPrime(Integer.MIN_VALUE)); assertTrue(RandomUtils.isNotPrime(-1)); assertTrue(RandomUtils.isNotPrime(0)); assertTrue(RandomUtils.isNotPrime(1)); assertTrue(!RandomUtils.isNotPrime(2)); assertTrue(!RandomUtils.isNotPrime(3)); assertTrue(RandomUtils.isNotPrime(4)); assertTrue(!RandomUtils.isNotPrime(5)); assertTrue(RandomUtils.isNotPrime(Integer.MAX_VALUE - 1)); assertTrue(!RandomUtils.isNotPrime(Integer.MAX_VALUE)); }