java – Short toHexString

There is a method integer Tohexstring() and long toHexString(). For some reason, they did not implement short toHexString().

What is the canonical method to convert short to hexadecimal string?

It is not possible to use integer Tohexstring(), because integer Tohexstring (- 33) is equal to ffffdf, which is not a very short value

resolvent

Solution

If short is 16 bit in the system, you can also simply perform the following operations

String hex = Integer.toHexString(-33 & 0xffff);

The above is all the contents of Java – short tohexstring collected and sorted out by programming house for you. I hope this article can help you solve the program development problems encountered by Java – short tohexstring.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>