string to int java big int code example
Example 1: transformer un string en Biginteger java
String foo = "some text";
byte[] fooBytes = foo.getBytes();
BigInteger bi = new BigInteger(fooBytes);
Example 2: transformer un string en Biginteger java
package com.mkyong;
import java.math.BigInteger;
public class JavaExample {
public static void main(String[] args) {
int n = 100;
System.out.println(n);
Integer integer = Integer.valueOf(n);
System.out.println(integer);
BigInteger bigInteger = BigInteger.valueOf(n);
System.out.println(bigInteger);
BigInteger bigInteger2 = BigInteger.valueOf(integer.intValue());
System.out.println(bigInteger2);
}
}