BigInteger toString() in Java

toString(): This method is available in java.math.BigInteger class of Java.

Syntax:

String java.math.BigInteger.toString()

This method returns the decimal String representation of this BigInteger.The digit-to-character mapping provided by Character.forDigit is used, and a minus sign is prepended if appropriate. 

Returns: decimal String representation of this BigInteger.

For Example:

BigInteger bigInteger = new BigInteger("1234")

bigInteger.toString()  = > It returns 1234.

Approach

Java

import java.math.BigInteger;

public class BigIntegertoString {
    public static void main(String[] args) {

        BigInteger bigInteger = new BigInteger("1234");
        System.out.println(bigInteger.toString());
    }
}

Output:

1234

No comments:

Post a Comment