给定一个可能非常大的整数值(以C#字符串格式),我想能够生成其十六进制等效项。通常的方法在这里不适用,因为我们谈论的是任意大的数字,50位或更多。我看到的技术使用像这样的技术:
// Store integer 182
int decValue = 182;
// Convert integer 182 as a hex in a string variable
string hexValue = decValue.ToString("X");
// Convert the hex string back to the number
int decAgain = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber);
由于要转换的整数过大,所以无法使用。
例如,我需要能够将这样的字符串转换为其十六进制等价物:
843370923007003347112437570992242323
以下方法都不能用: