BigInteger to String
In this chapter you will learn:
Convert BigInteger to String
String toString()
Returns the decimal String representation of this BigInteger.
import java.math.BigInteger;
/* j a v a 2 s . com*/
public class Main {
public static void main(String[] argv) throws Exception {
BigInteger bi = new BigInteger("1023");
String s = bi.toString();
System.out.println(s);
}
}
The output:
Convert BigInteger to String with given radix
String toString(int radix)
Returns the String representation of this BigInteger in the given radix.
import java.math.BigInteger;
/*j av a 2 s. com*/
public class Main {
public static void main(String args[]) {
BigInteger n = new BigInteger( new byte[] { 0x1, 0x00, 0x00 } );
System.out.println(n.toString(10));
}
}
The output:
Next chapter...
What you will learn in the next chapter:
- How to calculate Big andNot on BigInteger
- How to get the number of bit in a BigInteger
- How to clear designated bit from BigInteger
- How to flip designated bit in BigInteger
- How to negate a BigInteger
- How to do not operation on BigInteger
- How to do or operation on a BigInteger
- How to set bit value on BigInteger
- If the designated bit is set
- How to do bit xor calculation on BigInteger
Home » Java Tutorial » BigDecimal BigInteger