Java Data Type Tutorial - 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;
/*  w ww .  j a va2  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.