
Originally posted by RAGU KANNAN:
Hello,
127 in binary is 01111111
Shifted left one position, it becomes 11111110. equals to 254.
The value 254, doesn't fall within the range of a byte � this is overflow.
So the byte result is 2. I would like to know what is logic for byte termination
Thanks, Raghu.K
Originally posted by RAGU KANNAN:
Thank for the Answer Keith.
I have one more example wants to clarify.
For example I try to assign 1794 In bytes.
The byte values for 1794 is 0110 0000 0010. so it's positive value
and i am fliping the bit 0001 1111 1101 (I am not toching the sign bit)
and adding 1 bit 0001 1111 1110
From this how the system will find the "10" equals to "2".
Thanks, Raghu.k
Originally posted by RAGU KANNAN:
Thanks for the Amazing explanation.
How to convert Negative Decimal value into bytes.
For example 1001 = 1110 1001 (Negative "")
0001 0110 (Flipa)
0001 0111 (Add One Bit)
So 1001 = 23
I would like to produce 1001 = 23, I don't know how to convert this,
Pls explain to me.
Thanks, Raghu.K
SCJP 1.4  95%
SCJP 1.4  95%
Originally posted by RAGU KANNAN Sorry for the confusion my Question is.
How to fit decimal 1001 into bytes.
Thanks, Raghu.K
Originally posted by RAGU KANNAN:
The following example the leftmost value is sign indicator.
That is reason the byte value for " 1001 " is "23" (Negative 23).
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
SCJP 1.4  95%
SCJP 1.4  95%
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn KlassenKoop
https://coderanch.com/wiki/718759/books/BuildingWorldBackyardPaulWheaton
