The code below is to convert int to an integer, as well as an integer to a BigInteger. This example uses the namespace java.math.

import java.math.BigInteger;

public class IntConvertor{

    public static void main(String[] args) {

        int input = 10;
		//Print out
        System.out.println(input);

        // convert int to Integer
        Integer integer = Integer.valueOf(input);
        //Print out
        System.out.println(integer);

        // convert int to BigInteger
        BigInteger bigInteger = BigInteger.valueOf(input);
        //Print out
        System.out.println(bigInteger);
    }

}

Output

10

10

10

Related Articles

Exception Handling in C#

Functional Programming in C++

Replace hostname in URL using C#

 

Last modified: February 21, 2019

Comments

Write a Reply or Comment

Your email address will not be published.