casting bigint to integer code example
Example: java int to biginteger
// Primitive int
int myInt = 10
BigInteger bigInt = BigInteger.valueOf(myInt);
// Integer object
Integer integer = Integer.valueOf(myInt);
BigInteger bigInt = BigInteger.valueOf(myInteger.intValue());
bigInt = BigInteger.valueOf(myInteger); // works too