Converting Hexadecimal String to Decimal Integer

It looks like there’s an extra space character in your string. You can use trim() to remove leading and trailing whitespaces:

temp1 = Integer.parseInt(display.getText().trim(), 16 );

Or if you think the presence of a space means there’s something else wrong, you’ll have to look into it yourself, since we don’t have the rest of your code.

Leave a Comment