SableJBDD.bdd.internal
Class Prime

java.lang.Object
  extended bySableJBDD.bdd.internal.Prime

public class Prime
extends java.lang.Object

A class finds the smallest prime number above a given number This is a standard example from Sun's developer's forum. However, the algorithm itself is simple enough.


Constructor Summary
Prime()
           
 
Method Summary
static int getSmallestPrimeGTE(int n)
          Finds the smallest prime number greater than or equal to a given integer.
static boolean isPrime(int n)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Prime

public Prime()
Method Detail

getSmallestPrimeGTE

public static int getSmallestPrimeGTE(int n)
Finds the smallest prime number greater than or equal to a given integer.

Parameters:
n - a given integer
Returns:
the smallest prime number greater than or equal to n

isPrime

public static boolean isPrime(int n)
Returns:
true if a given number is a prime number