// File: TestBig.java (Module 8) // // Author: Rahul Simha // Created: October 5, 1998 // // Illustrates use of java.math.BigInteger. import java.math.*; public class TestBig { public static void main (String[] argv) { // Initialize. int i = 1; BigInteger I = new BigInteger ("1"); // We will need this constant. BigInteger Two = new BigInteger ("2"); // Compute successive powers of 2. for (int j=1; j<=64; j++) { i = i * 2; I = I.multiply (Two); System.out.println ("2 to the power " + j); System.out.println ("i = " + i); System.out.println ("I = " + I); System.out.print ("\n"); } } }