I am working towards the
SCJP 1.4 and have been working through the Mughal and Rasmussen Cert Guide. I see I have
alot more work to do on bit wise operators etc.
To the point though. I have been trying to figure out how a sequence of bits could be negative or positive when it could easily be a whole number.
By trawling various threads I see that if the first bit is 0 or 1 in the highest position for that primitive type signifies whether the decimal representation is negative or positive.
eg> the dots signify zeros or ones
on a primative
byte 0... .... means it is positive and 1... .... is negative
short 0... .... .... .... is positive and 1... .... .... .... negative
int 0(31dots) is positive and 1(31dots) is negative
etc
So
byte has one sign and 7 positions
short has one sign and 15 positions
etc
I just need to get this straight in my head before moving on.
Sorry if this is obvious.
Thanks so much for your help so far, and the help in the future.
Regards,
Gary