i want to multiply two 512 bit integers in java and store the result.suggest some method to do this.
I suggest you use java.math.BigInteger
Use java.math.BigInteger
A quick example of usage:
import java.math.BigInteger;
public class BigIntegerTest {
public static void main(String[] args) {
BigInteger b1 = new BigInteger("200000000000000000000000000000000001");
BigInteger b2 = new BigInteger("400000000000000000000000000000000000");
System.out.println(b1.multiply(b2));
System.out.println(b1.bitCount());
System.out.println(b1.pow(13));
}
}
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