permaculture playing cards*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Confusion in Shift  (edit: 1.4 topic) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Confusion in Shift  (edit: 1.4 topic)" Watch "Confusion in Shift  (edit: 1.4 topic)" New topic
Author

Confusion in Shift (edit: 1.4 topic)

Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
128 >>> 2
128 >> 2

-128 >>> 2
-128 >> 2

How the above four will be different? I have great confusion in understanding right shift signed and unsigned operators. Can anybody pls explain it for me?
[ November 25, 2006: Message edited by: Bert Bates ]

Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
Sathishkumar Ethiraju
Greenhorn

Joined: Nov 23, 2006
Posts: 10
128 >>> 2
with sign
128 >> 2
without sign

abv 2 won have diff

-128 >>> 2
with sign


-128 >> 2
without sign

in the case of >>> MSB will also get shifted
0 is the msb in case of positive numbers
and 1 for negative numbers
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8803
    
    5
rmember ranchers - this topic is only on the 1.4 exam, it's NOT on the 5.0 exam!


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusion in Shift (edit: 1.4 topic)
 
Similar Threads
Shift operators
shift operators
About unsigned right shift operator
operators
Whats the output