BigInteger d;
int f = 256;
BigInteger g = 101;
BigInteger st = TWO.pow(f);
BigInteger n = st.add(g);
This is the error:
incompatible types
found : int
required: java.math.BigInteger
BigInteger g = 101;
^
1 error
Basically I need the big num library to compute 2^(255)+101 and store
that in the variable n...what do I do?
Thomas Schodt - 08 Nov 2005 09:49 GMT
> Basically I need the big num library to compute 2^(255)+101 and store
> that in the variable n...what do I do?
Like so?
import java.math.BigInteger;
public final class Toy {
public static final BigInteger TWO = BigInteger.ONE.shiftLeft(1);
public static final BigInteger ONEHUNDREDONE = new BigInteger("101");
public static final BigInteger twoPower255plus101 =
TWO.shiftLeft(255-1).add(ONEHUNDREDONE);
public static final void main(String[] arg) {
System.out.println(twoPower255plus101.toString(16));
}
}