## How do I convert BigInteger into another radix number?

In this example you’ll see how we can convert a `java.math.BigInteger` number into another radix such as binary, octal and hexadecimal.

``````package org.kodejava.math;

import java.math.BigInteger;

public class BigIntegerConversion {
public static void main(String[] args) {
BigInteger number = new BigInteger("2021");
System.out.println("Number      = " + number);
System.out.println("Binary      = " + number.toString(2));
System.out.println("Octal       = " + number.toString(8));

number = new BigInteger("FF", 16);
System.out.println("Number      = " + number);
System.out.println("Number      = " + number.toString(16));
}
}
``````

The result of our examples:

``````Number      = 2021
Binary      = 11111100101
Octal       = 3745
Number      = 255
Number      = ff
``````

## How do I do math operation for BigInteger?

``````package org.kodejava.math;

import java.math.BigInteger;

public class BigIntegerOperation {
public static void main(String[] args) {
BigInteger numberA = new BigInteger("98765432123456789");
BigInteger numberB = BigInteger.TEN;

System.out.println("numberA = " + numberA);

numberA = numberA.multiply(numberB);
System.out.println("numberA = " + numberA);

numberA = numberA.subtract(numberB);
System.out.println("numberA = " + numberA);

numberA = numberA.divide(numberB);
System.out.println("numberA = " + numberA);

numberA = numberA.mod(numberB);
System.out.println("numberA = " + numberA);

numberA = numberA.pow(2);
System.out.println("numberA = " + numberA);

numberA = numberA.negate();
System.out.println("numberA = " + numberA);
}
}
``````

Our class result are:

``````numberA = 98765432123456799
numberA = 987654321234567990
numberA = 987654321234567980
numberA = 98765432123456798
numberA = 8
numberA = 64
numberA = -64
``````