The difference between >> and >>> in Java

Source: Internet
Author: User

See the Code Demo:

Package day02;/** * >> and >>> difference? */public class MyTest {public static void main (string[] args) {/* * 5 * *  00000000 00000000 00000000 00000101 */int A = 5;int A1 = A>>1;int A2 = a>>>1; System.out.println (a1+ "--" +a2); 2--2/* *-5 *  * 10000000 00000000 00000000 00000101  --Original code * 11111111 11111111 11111111 11111010  --Anti-code * 111111 11111111 11111111 11111011  --Complement *  * 11111111 11111111 11111111 11111101  --(-3) * 01111111 11111111 1111111 1 11111101  -(2147483645) */int b = -5;int B1 = b>>1;int B2 = b>>>1; System.out.println (b1+ "--" +b2); -3--2147483645/* * Summary: * 1.>> need to consider the symbol bit * 2.>>> do not consider the sign bit, the missing bit number 0 * * * *  }}

It is wrong to also look at the correct!!!



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The difference between >> and >>> in Java

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.