Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what would be the result of this

 
sura watthana
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone help me out?
what would be the result of this
(-1>> 1)

and

(-1>>>1)

and

(-42>>-4) and why

thanks
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried them?
 
Joyce Lee
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sura,

Check out Corey McGlone's Bit Shifting for explanation.


Output:
11111111111111111111111111111111
11111111111111111111111111111111

Joyce
[ November 18, 2004: Message edited by: Joyce Lee ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic