Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

shift operators

 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int i =10
int result = i<< 4;
as a thumb rule .... this means ,int result = 10*2 to the power 4;
int result = i>>4
as a thumb rule .... this means ,int result = 10/2 to the power 4 ;

please if anybody could explain me >>> operator .
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>> is the unsigned shift operator.
You have to understand how the shift operator really works to understand the difference. Your rules of thumb are true, but they aren't going to help you understand >>>. There are a lot of threads that deal with this topic alread. Do a search in this forum for "shift" and you'll get your answer.
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would really appreciate if you could explain it to me . I like to make thumb rules as it makes me understand a pirticular thing ,well .
thanks in advance
raghav mathur
Originally posted by Rob Ross:
>>> is the unsigned shift operator.
You have to understand how the shift operator really works to understand the difference. Your rules of thumb are true, but they aren't going to help you understand >>>. There are a lot of threads that deal with this topic alread. Do a search in this forum for "shift" and you'll get your answer.
 
Rodney Woodruff
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this link. It helped me alot.
http://www.javaranch.com/campfire/StoryBits.jsp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic