Is 3<<2 Equivalent to 3*4 in java?? If yes then how | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is 3<<2 Equivalent to 3*4 in java?? If yes then how

28th Jun 2017, 10:16 AM
Jaina Trivedi
Jaina Trivedi - avatar
2 Answers
+ 1
if we will shift 0011(binary of three) twice left side we get 11 = 1100( which is equal to 12).
28th Jun 2017, 11:56 AM
Jaina Trivedi
Jaina Trivedi - avatar
0
"<<" and ">>" are the bit shift operators in Java. But as you just answered your own question, is there still anything you don't understand?
28th Jun 2017, 12:14 PM
Mo Jakobi
Mo Jakobi - avatar