Bitwise operators in Java:
>>: means right shift. If the number is positive, the high bits are filled with 0. If it is a negative number, then Fill the high bits with 1;
>>>: Indicates unsigned right shift, also called logical right shift, that is, if the number is positive, the high bits will be filled with 0, and if the number is negative, the right The high bit after the shift is also filled with 0.
The expression is:
result = exp1 >> exp2; result = exp2 >>> exp2;
means moving the number exp1 to the right by exp2 bits.
For example: The binary number of
res = 20 >> 2;
20 is 0001 0100. After shifting right by 2 bits, it is 0000 0101. The result is res = 5; the binary number of
res = -20 >> 2;
-20 Add 1 to the complement of its positive number, that is, 1110 1011. After shifting right by 2 bits, it is 1111 1100. The result is res = -6;
And for the >>> symbol:
res = 20 >>> 2;
The result is the same as >
##Supplement:
>, which means moving exp1 to the left by exp2 bits and filling in the low bit with 0. In fact, moving n bits to the left is equivalent to multiplying by 2^n.
There is no Recommended tutorial:Java tutorial
The above is the detailed content of The difference between >>> and >> in java. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

SublimeText3 Chinese version
Chinese version, very easy to use