![]() |
VOOZH | about |
public String toString(int radix)Parameter: This method accepts a single mandatory parameter radix which is the radix of String representation. Return Value: This method returns decimal String representation of this BigInteger in the given radix. Examples:
Input: BigInteger1=321456 radix =2 Output: 1001110011110110000 Explanation: BigInteger1.toString(2)=1001110011110110000. when radix is 2 then function will first convert the BigInteger to binary form then it will return String representation of that binary number. Input: BigInteger1=321456 radix=16 Output: 4e7b0 Explanation: BigInteger1.toString()=4e7b0. when radix is 16 then function will first convert the BigInteger to hexadecimal form then it will return String representation of that hexadecimal number.Below programs illustrate toString(int radix) method of BigInteger class: Example 1: When radix = 2. It means binary form String.
Binary String of BigInteger 321456 is equal to 1001110011110110000
Octal String of BigInteger 34567876543 is equal to 401431767677
Hexadecimal String of BigInteger 8765432123456 is equal to 7f8dc77d040
public String toString()Return Value: This method returns decimal String representation of this BigInteger. Examples:
Input: BigInteger1=321456 Output: 321456 Explanation: BigInteger1.toString()=321456. The answer is the String representation of BigInteger Input: BigInteger1=59185482345 Output: 59185482345 Explanation: BigInteger1.toString()=59185482345. The answer is the String representation of BigIntegerBelow programs illustrate toString() method of BigInteger class: Example:
35152194853456789 7654323234565432345676543234567