Java BigInteger(String val) Constructor

Syntax

BigInteger(String val) constructor from BigInteger has the following syntax.

public BigInteger(String val)

Example

In the following code shows how to use BigInteger.BigInteger(String val) constructor.


import java.math.BigInteger;
/* ww  w  . j av a2 s.c  o m*/
public class Main {
  public static void main(String[] args) {
    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());
  }

}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger