Demonstrate large numbers : Big Integer « Development Class « Java






Demonstrate large numbers

Demonstrate large numbers

import java.math.*;

/**
 * Demonstrate large numbers.
 * @author Ian F. Darwin, http://www.darwinsys.com/
 * @version $Id: BigNums.java,v 1.4 2004/02/09 03:33:56 ian Exp $
 */
public class BigNums {
  public static void main(String[] argv) {
    //+
    System.out.println("Here's Long.MAX_VALUE: " + Long.MAX_VALUE);
    BigInteger bInt = new BigInteger("3419229223372036854775807");
    System.out.println("Here's a bigger number: " + bInt);
    System.out.println("Here it is as a double: " + bInt.doubleValue());
    //-
  }
}


           
       








Related examples in the same category

1.Big Integer demo
2.Another Big Integer
3.A trivial reverse-polish stack-based calculator for big numbers