Page 1 of 1

Negative Values seen for numbers greater than 0x7FFF

Posted: Fri Apr 22, 2016 9:33 am
by Kamishetti
Dear Members,

Greetings for the day ahead.

I have started using the JCIDE very recently and developed a sample applet using it.

While I try to debug the applet for some command, I observed that by default, the IDE is treating all the numbers greater that 0x7FFF as negative numbers.

I do not know if there is some settings to be done to consider such numbers as positive only.

Anybody could kindly help me to get this issue resolved?

Please find the attached screenshot of my debugging and observation for more details.

In this example, I have taken hex value 0x9154, for which the IDE shows its value in brackets as -28332.

Thank you all in advance.

Have a nice weekend. :)

Re: Negative Values seen for numbers greater than 0x7FFF

Posted: Fri Apr 22, 2016 11:00 pm
by UNKNwYSHSA
Here is the documentation of java data types: https://docs.oracle.com/javase/tutorial ... types.html

Here's the explanation of your short value:
short: The short data type is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters.

You can use type int if the balance is greater than 32767.
Please pay special attention to this problem in your code.

Re: Negative Values seen for numbers greater than 0x7FFF

Posted: Mon Apr 25, 2016 12:08 am
by Kamishetti
Dear UNKNwYSHSA,

Thank you very much for your reply.

I will implement the changes and come back to you.

Have a nice week ahead.



Best Regards,

K. Sandeep Kumar.