BigNumApp.java Source code

Java tutorial

Introduction

Here is the source code for BigNumApp.java

Source

import java.math.BigInteger;

public class BigNumApp {
    public static void main(String args[]) {
        BigInteger n = new BigInteger("1000000000000");
        BigInteger one = new BigInteger("1");
        while (!n.isProbablePrime(7))
            n = n.add(one);
        System.out.println(n.toString(10) + " is probably prime.");
        System.out.println("It is " + n.bitLength() + " bits in length.");
    }
}