Quick understanding of java operator right shift and left shift

Quick understanding of java operator right shift >> and left shift <<

"<< ": Left shift operator, num << n, equivalent to num multiplied by 2 to the nth power
" >> ": Right shift operator, num >> n, equivalent to num divided by 2 n power

ps:

1<<4 , 即 1×2^4=16;
2<<3 , 即 2×2^3=16;
3<<5 , 即 3×2^5=96;

16>>4, that is, 16÷2^4=1;
16>>3, that is, 16÷2^3=2;
96>>5, that is, 96÷2^5=3;
 

Guess you like

Origin blog.csdn.net/Mint6/article/details/100645264