public class BigIntegerUtils extends Object
Obtained from Apache Xerces and Aduna Software code on java2s.com.
Modifier and Type | Method and Description |
---|---|
static BigInteger |
bigIntegerFromBytes(byte[] bytes)
Converts a byte array to a positive BigInteger
|
static byte[] |
bigIntegerToBytes(BigInteger bigInteger)
Converts a BigInteger into a byte array ignoring the sign of the BigInteger, according to RFC2945 specification
|
static BigInteger |
fromHex(String hex)
Decodes the specified hex string into a big integer.
|
static String |
toHex(BigInteger bigint)
Encodes the specified big integer into a hex string.
|
public static String toHex(BigInteger bigint)
bigint
- the value to convert to a hexidecimal stringnull
if the
input is undefined.public static BigInteger fromHex(String hex)
hex
- The hex encoded string to decode.null
if decoding
failed.public static BigInteger bigIntegerFromBytes(byte[] bytes)
bytes
- byte array in big endian unsigned RFC2945 formatpublic static byte[] bigIntegerToBytes(BigInteger bigInteger)
bigInteger
- BigInteger, must not be null, should not be negativeCopyright © 2017 Connect2id Ltd.. All Rights Reserved.