Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /************************************************************************
- * A business logic example *
- * This class (this package, actually) is invoked by the GUI class. *
- * *
- ************************************************************************/
- package BusinessLogicPackage;
- import java.math.BigInteger;
- import GUIPackage.MyForm;
- public class PrimeNumbers{
- public static boolean BigIntisPrime(BigInteger b) {
- BigInteger i = new BigInteger("2");
- while (i.compareTo(b) < 0){
- BigInteger tmp = b.mod(i);
- if(tmp.compareTo(BigInteger.ZERO) == 0) {
- //System.out.println("Factor Found: " + i.toString());
- return false;}
- i = i.add(BigInteger.ONE);
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement