No.
There are no BigInteger constructors
that take an int or other primitive type as an argument.
int x = 492; BigInteger value = BigInteger.valueOf( x ) ;
You could do this:
BigInteger value = new BigInteger( "492" );
But what if you calculated a value using ints, and now need it to be a BigInteger?
Do this:
int a = 492;
int b = 385;
int sum = a+b;
BigInteger value = BigInteger.valueOf( sum );
Here is another program:
BigInteger has three built-in constants that correspond to the obvious values:
public static final BigInteger ZERO public static final BigInteger ONE public static final BigInteger TEN
These are static, which means they are
part of the class so you don't need to make an object to use them.
import java.math.BigInteger;
class BigIntConst
{
public static void main ( String[] args )
{
BigInteger a = new BigInteger( "45" );
BigInteger c = a.add( BigInteger.TEN );
c = c.subtract( BigInteger.ZERO );
System.out.println("Result: " + c );
}
}
What is the output of the above program?