我需要将十六进制值解析为以 10 为底的长整数。价值类似于:
9F2EEA4AA03D55B33172E9A86CFF6156AC1628C67983193A337B98995151F9B0F41562290DB98697280E805803E4B18914519CEB55CEA5D03A927C28C36A4BC7
我怎样才能做到这一点?
更新:
在python中,我使用了以下内容:
>> num = "9F2EEA4AA03D55B33172E9A86CFF6156AC1628C67983193A337B98995151F9B0F41562290DB98697280E805803E4B18914519CEB55CEA5D03A927C28C36A4BC7"
>> int(num, 16)
>> 8337103942674051648235321365669510487642415361796636721089378763661406518267124809778145800381557738780272231500412167743930433352841689114003303823985607L
当我的同事尝试@Sergey 的回答时,我的同事得到了不同的结果(负值,而我的不是负值)
>> BigInteger bigInteger = BigInteger.Parse(num, NumberStyles.HexNumber);
>> -5070703987268545451338703632536335639836950458795756656634182680060357511806422167023728497785345688909759626686073883109823449459104880832430345182098489