Home  >  Article  >  Java  >  What does the "<<" symbol in java mean?

What does the "<<" symbol in java mean?

王林
王林Original
2019-11-15 09:35:1811178browse

What does the

Mathematical meaning: As long as the number does not overflow, for positive and negative numbers, shifting one position to the left is equivalent to multiplying by 2 raised to the power of 1, and shifting n bits to the left is equivalent to multiplying n by 2. second power.

What does the << symbol in java mean?

##For example:


Calculation: 3 3 1. First convert 3 into binary numbers 0000 0000 0000 0000 0000 0000 0000 0011.

2. Then move out the two zeros in the high bits (left) of the number, shift the other numbers 2 bits to the left, and finally fill in the two empty bits in the low bits (right) with zeros.

3. The final result is 0000 0000 0000 0000 0000 0000 0000 1100, which is 12 when converted to decimal.

Recommended tutorial:

Java tutorial

The above is the detailed content of What does the "<<" symbol in java mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn