Convert hexadecimal strings to unsigned byte arrays in Java

I get a 14 byte hexadecimal string, such as a55a0b0500000000000022366420ec

But I want to compare them with such bytes: if (bytearray [13] = = 0xec) since 235 is larger than the signed byte, the if statement will fail Do you know how to solve this problem in Java? thank you!

Solution

Try if (bytearray [13] = = (byte) 0xec)

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
分享
二维码
< <上一篇
下一篇>>