Right and Left shift operators

The right and left shift operators are binary operators.One operand represents the number in which bits are to be shifted and the other operand represents the shift positions.The shift operators are applied on integer data type variables.

Right shift operator

The right shift operator shifts all the bits of a binary number in the right direction.





Binary representation of 6 in bits.

0000       0110

The operator shifts the bits of this binary number to right by 2 positions,the two rightmost bits are discarded.

0000      0001 6>>2=1

The formula is                 operand / 2(power)number.


Left shift operators

The left shift operator shifts all the bits of a binary number in the left direction.





Binary representation of 4 in bits.

0000       0100

The operator shifts the bits of this binary number to left by 2 positions,the two leftmost bits are discarded.

0001    0000

The formula is                 operand *2(power)number.


Unsigned shift operator

unsigned shift operator is used to shift the bits of a binary number to right.The operator fills leftmost bits of a binary value with 0 irrespective of whether the number has 0 or 1 at the leftmost bit.



Binary representation of 6in bits.(64 bit representation)

00000000 00000000 00000000 00000110


00000000 00000000 00000000 00000000










Like it on Facebook, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet

What martial arts do you like or what martial arts is the best?

What's the best? What do you like? What attracts you the most?
No answer selected. Please try again.
Please select either existing option or enter your own, however not both.
Please select minimum 0 answer(s) and maximum 7 answer(s).
[{"id":"20601","title":"Karate","votes":"32","type":"x","order":"0","pct":33.68,"resources":[]},{"id":"20602","title":"Jeet Kun Do","votes":"3","type":"x","order":"0","pct":3.16,"resources":[]},{"id":"20603","title":"Taekwondo","votes":"12","type":"x","order":"0","pct":12.63,"resources":[]},{"id":"20604","title":"Jiu Jitsu","votes":"11","type":"x","order":"0","pct":11.58,"resources":[]},{"id":"20605","title":"Judo","votes":"9","type":"x","order":"0","pct":9.47,"resources":[]},{"id":"20606","title":"Kung Fu","votes":"21","type":"x","order":"0","pct":22.11,"resources":[]},{"id":"20607","title":"Other","votes":"7","type":"x","order":"0","pct":7.37,"resources":[]}] ["#ff5b00","#4ac0f2","#b80028","#eef66c","#60bb22","#b96a9a","#62c2cc"] ["rgba(255,91,0,0.7)","rgba(74,192,242,0.7)","rgba(184,0,40,0.7)","rgba(238,246,108,0.7)","rgba(96,187,34,0.7)","rgba(185,106,154,0.7)","rgba(98,194,204,0.7)"] 350
bottom 200
No married couple wants to end up getting divorced. It is not like they have planned for it. They try to put up with their partners for as long as they
Due to our modern lifestyle, we feel that digestion related disorders are a common problem. Thus, we neither give importance to them nor seek any help
The bond of marriage brings the two people together. Initially, everything may seem okay and both of them slowly start discovering each other in the journey.
  The next morning, when Shalini's mortal remains were brought to Akashdeep, it was drizzling but that did not stop the estate workers from the
After the tragedy and Shalini's Parents  The atmosphere at Akashdeep and the surrounding estate was one of gloom, foreboding and frankly unbearable,with
  The Mysterious  Incident at Akashdeep Estates – 12 Meeting Vidyakka again The next day was usual and after lunch Mahesh anna went up
  The Mysterious  Incident at Akashdeep Estates – 11   Shalini Confides As we sat down for lunch it began to rain and it was no
 The Mysterious  Incident at Akashdeep Estates – 10   That night it rained heavily and we had a power cut soon after we had finished