Java BigInteger.toString()

Syntax

BigInteger.toString() has the following syntax.

public String toString()

Example

In the following code shows how to use BigInteger.toString() method.


// w  ww.ja va2  s.  com
import java.math.BigInteger;

public class Main {

  public static void main(String[] args) {

    BigInteger bi1 = new BigInteger("1234");
    BigInteger bi2 = new BigInteger("-1234");

    System.out.println(bi1.toString());
    System.out.println(bi2.toString());
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger