### Discussion :: Operators and Assignments - Pointing out the correct statements (Q.No.3)

Naveen said: (Mar 7, 2011) | |

Is correct. 16 >>> 2 = 4. How it will come will you please provide mathamatically discription. |

Sneha said: (Jun 9, 2011) | |

I also wanna know the same thing.. |

Badri said: (Jul 11, 2011) | |

Please explain the above expression (such as 16>>>2). |

Hareram said: (Sep 22, 2011) | |

Please explain it detail how. ? |

Khyati said: (Nov 17, 2011) | |

In binary 16 is 10000, now shift the bits two places to the right (>>2)and we get 100 which is 4. |

Anil said: (Dec 7, 2011) | |

In binary 16 is 10000, now shift the bits two places to the right (>>2)and we get 100 which is 4 In binary 16 is 10000, now shift the bits three places to the right (>>>2)and we get 10 which is 2 So how the 2 and 4 is correct? |

Jose Marti said: (Jan 21, 2012) | |

Because the unsigned right shift operator ">>>" shifts a ZERO into the leftmost position. In binary 16 is 10000, now shift the bits two places to the right. We get 100. Then add a 0 into the leftmost position, we get 0100 which is 4. |

Rohan said: (Feb 9, 2012) | |

Thanks Jose. |

Bikash Dey said: (Feb 16, 2012) | |

Can any one tell me mathematically how is 16/2 ^ 2 = 10. |

Mmintz01 said: (Mar 5, 2012) | |

16/2 equals 8 so in binary represents the number 1000 if you xor (8^2) this with 2 in binary meaning 0010 you have 1010 in binary which is 10 in decimal system. |

Mukesh said: (Apr 24, 2013) | |

For 16>>2=4 is OK but still I am not getting how you did 16>>>2 =4. What is the meaning of three >>> symbols. Two >> means bit-wise shifting. What is the meaning of X>>>y ? |

Utpal Sharma said: (Jun 23, 2013) | |

In java >> and >>> both have same meaning right shift and 16/2^2 here first 16/2=8 and then 8^2 perform bitwise OR operation so 8 in binary 1000, 2 is 0010 output is 1010 which is 10. |

D.Sapna said: (Nov 28, 2013) | |

What is the difference between 16>>2 and 16>>>2? |

Asmat said: (Jan 21, 2014) | |

16>>2 signed right shift. 16>>>2 unsigned right shift.. the most significant bit in >> is sign bit, so that if the sign bit is 0, the number is positive and if the sign bit is 1 the number is negative. Here since the number is already positive when we shift by >>, we get 100 and when we use >>> we get 0100, the 0 before 1 represents that its a positive number..Had this been -16, the answer would have been 100 for >> and 1100 for >>>. |

Isaac said: (Sep 4, 2014) | |

Which of these statements are equivalent 3/2, 3<2, 3*4, 3<<2. |

Kumari.N said: (Sep 16, 2014) | |

3/2 = 1 (Integer arthimetic). 3<2 = false. 3*4 = 12. 3<<2 = 12 In binary 3 is 11 and left shift 11 to two places that is 1100. Which is equal to 12. |

Venkat said: (Feb 28, 2015) | |

Guys can you please explain about third option "(3) is wrong, 16/2^2 = 10" how? |

Eod said: (Mar 22, 2015) | |

@Venkat, '^' operation is not Math.Exp, as @Utpal said before it's bit wise OR operation. |

Abhi said: (Sep 11, 2015) | |

The >>> operator shifts the bits of expression 1 right by the number of bits specified in expression 2. Zeroes are filled in from the left. Digits shifted off the right are discarded. |

Prajwal said: (Dec 18, 2015) | |

This work in hexa-decimal format. Ex: We have 16 >>> 2. 0000 0000 0001 0000 --> 16. Then 16 shifted by 2. 0000 0000 0000 0100 --> 4. Observe 1 is shifted by 2. |

Sumit said: (Feb 5, 2016) | |

Hi, how this is possible? |

Priyanka Srivastava said: (Aug 14, 2016) | |

Sir, please give the explanation about how 16 >>> 2 is equals 16 >> 2. I do not understand the question. |

Santhosh said: (Nov 26, 2016) | |

2<<3 what is the answer, can you explain me? |

Gowthami said: (Sep 9, 2017) | |

Answer is 16. |

Neethu said: (Nov 16, 2017) | |

16/2^2. 16/2=8->1000. 1000^0010=1010~=10. |

Allauddin Pirjade said: (Feb 13, 2018) | |

In simple words >>> always shifts a zero into the leftmost position whereas >> shifts based on sign of the number i.e. 1 for negative number and 0 for positive number. |

Khan said: (May 1, 2018) | |

16>>2 signed right shift. 16>>>2 unsigned right shift. The most significant bit in >> is sign bit, so that if the sign bit is 0, the number is positive and if the sign bit is 1 the number is negative. Here, since the number is already positive when we shift by >>, we get 100 and when we use >>> we get 0100, the 0 before 1 represents that its a positive number. Had this been -16, the answer would have been 100 for >> and 1100 for >>>. |

#### Post your comments here:

Name *:

Email : (optional)

» Your comments will be displayed only after manual approval.