how to convert a byteArray to bigInteger? it's important to say than my bytearray is not the ordinay byte[].. its a class in my project. basically i have an array of 256 bytes and i need to represent it as BigInteger in order to perform a calculation .
the code looks like this:
//this is how i get my information in byteArray
ByteArray modulus = (ByteArray)inParamsList.getParameterType("modulus");
//this is the line that i get an exception for. it happens because the "toString" doesn't actully converts it to string
BigInteger modulusInBig = new BigInteger(modulus.toString());
i would be very happy to get some answers! i lookes all over the internet already...
Modify your ByteArray
class to provide a toArrayByte()
method, returning byte[]
then:
BigInteger modulusInBig = new BigInteger(modulus.toArrayByte());
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