Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why are there two right shift operators( Right Shift and Zero Fill Right Shift) but only one left shift operator in JAVA???
In other words, why are there not << and <<< exist in JAVA as >> and >>> do???
Posted

1 solution

The right shift will normally fill with the sign bit, which is the left most bit. There is no "special" bit when doing a left shift, hence it is always zero fill.
 
Share this answer
 
Comments
Tamanna9931 27-Jan-13 11:36am    
it can be done... << can be made as filling with Least Significant Bit and then <<< can be operated as zero fill left shift.. but this had not been done,,, this is the question...
Richard MacCutchan 27-Jan-13 11:43am    
It cannot be done, because most hardware does not offer the feature. And furthermore, there is no real need for it. The designers of computers and languages did not provide this feature for the reason that there is no logical reason for it.
Sergey Alexandrovich Kryukov 27-Jan-13 12:22pm    
Reasonable explanation, my 5.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900