Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RightShift Operator....  RSS feed

 
yunuss khan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Can you please explain me in detail about Shift Operators how its works.

Leftshift << ,Right >>,>>>

Thanks & Regards,
yunus
 
Avinash Rawana
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shifting has thousands of results and can be used for many things, but there is a tutorialthat ought to get you started.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Sun Tutorials:

The signed left shift operator "<<" shifts a bit pattern to the left, and the signed right shift operator ">>" shifts a bit pattern to the right. The bit pattern is given by the left-hand operand, and the number of positions to shift by the right-hand operand. The unsigned right shift operator ">>>" shifts a zero into the leftmost position, while the leftmost position after ">>" depends on sign extension.


Are you comfortable with the bit patterns for various numbers and characters?
 
Anca Sarbu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

It's really a funny page but it helped me: Cat and Mouse Games with Bits
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!