java convert string to bitinteger code example

Example 1: transformer un string en Biginteger java

package org.arpit.java2blog;
 
import java.math.BigInteger;
 
public class StringToBigIntegerMain {
 
	public static void main(String[] args) {
 
		String str="45";
		BigInteger bigIntegerStr=new BigInteger(str);
		System.out.println("Converted String to BigInteger: "+bigIntegerStr);
	}
}

Example 2: transformer un string en Biginteger java

String foo = "some text";
byte[] fooBytes = foo.getBytes();
BigInteger bi = new BigInteger(fooBytes);

Tags:

Java Example