The method you want is BigInteger#valueOf(long val).
E.g.,
BigInteger bi = BigInteger.valueOf(myInteger.intValue());
Making a String first is unnecessary and undesired.
converting Integer to BigInteger
BigInteger big_integer = BigInteger.valueOf(1234);
converting BigInteger back to Integer
int integer_value = big_integer.intValue();
converting BigInteger back to long
long long_value = big_integer.longValue();
converting string to BigInteger
BigInteger bigInteger = new BigInteger("1234");
converting BigInteger back to string
String string_expression = bigInteger.toString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With