“3 is represented as the binary int value
00000000 00000000 00000000 00000011
Inverting each of the bits yields
11111111 11111111 11111111 11111100,
which is the bit pattern for -4 as an int value.”
Really. How????
Pass me that brick wall please.
Edited to add some links that are supposed to be useful (to me, studying java…)
Sun Education http://www.sun.com/service/suned
http://www.enterprisedeveloper.com/jcertify
http://www.jchq.net
http://www.javaranch.com
http://www.javacert.com




Comments
6 responses to “More studying.”
Search me, can I share the brick wall when you find one
A C/C++ programmer speaks:
Sign is indicated by the Most Significant Bit in signed datatypes.
Unless the type is marked as unsigned, the type defaults to signed.
http://www.google.com/search?num=100&q=signed+unsigned+msb+java+int+datatype
Yes, I know that about the sign (used to be a C programmer myself 😉 …it’s more a confusion as to how a number consisting of ones could be a small number – but I think I sorted it out with some googling myself earlier. http://www.google.co.uk/search?hl=en&q=bit+patterns+negative+numbers&btnG=Google+Search&meta= and chose the third option.
Oh so I get the brick wall all to myself now?!
nope, I still don’t get bitshifting. Although now I get why…