The method of c #
BigInteger. Parse (string val, NumberStyles HexNumber)
BigInteger. Parse (" FFFFFFFFFFFEA070, "NumberStyles. HexNumber) is the result of the - 90000
Use [note: if the number of top two hexadecimal string is equal to or greater than 0 x80, then the Parse () method will be the first as the sign bit, namely it is stored as a negative number -- -- -- -- -- found on the Internet]
Then this method in the Java
New BigInteger (String val, int radix)
New BigInteger (" FFFFFFFFFFFEA070 ", 16) is the result of the 18446744073709461616
Two methods are hexadecimal to decimal (I should say yes!), but the result is not the same as
How to change the Java methods above results to the same as the result of the c #
May be expressed is not very clear, forgive me...
CodePudding user response:
Types of Java byte is signed (Java is no unsigned types of data), range: - 0128 ~ 127C # numerical byte is unsigned types, range: 0 ~ 255
Solution:
C # a sbye is signed, use sbye [] to replace bye [], conversion issues are resolved,
CodePudding user response:
Use BigInteger. The Parse () convert hexadecimal string for decimal Numbers have two points:1, hex string cannot "0 x" or "& amp; H "prefix for
2, if the number of top two hexadecimal string is equal to or greater than 0 x80, then the Parse () method will be the first as the sign bit, namely it is stored as a negative number, if you need to put this hexadecimal string parsing is positive, the need to add "0" in front of the string,
If you sink down, look carefully, there will be no this question
CodePudding user response: