Exception in hexadecimal to int number format in Java

I encountered a number format exception while trying to do this

int temp = Integer.parseInt("C050005C",16);

If I reduce one of the hexadecimal numbers it converts, but not Why and how to solve this problem?

Solution

This causes integer overflow because integers are always signed in Java From the document of that method:

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