Home> Java> JavaBase> body text

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

王林
Release: 2019-11-15 18:05:23
Original
11168 people have browsed it

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!