Java Review (1)

Source: Internet
Author: User

These days, the interview, the interview when a lot of knowledge point is also very unfamiliar, this two days first to review the Java Foundation, there is a period of time did not write a blog, today, first talk about the conversion of the system.

1. Binary number of the original code, complement and anti-code

1): For positive number of the original code, complement and anti-code are the same, not discussed here.

2) Next we discuss negative binary source code, inverse code, and complement

The original code of the negative binary: calculates the binary value of the absolute value first, then the binary each bit of data is reversed, and finally add 1. The binary inversion form of negative numbers is the corresponding integer binary negation and then the addition of a

Eg:-32

First step: Calculate the binary number of absolute values: 32 (10) =0010 0000 (2)

Step two: Take the reverse: 1101 1111

Step three: Add one: 1110 0000

     So-32 of the original code is: 1110 0000

Anti-code: Negative number of the inverse code equals: The original code the highest bit unchanged, the remaining bits are reversed.

Eg:-32

Original code: 1110 0000

Anti-code: 1001 1111

Complement: The complement of the negative is equal to: the highest position is unchanged, the remaining bits are reversed, and the last one

Eg:-32

Original code: 1110 0000

Anti-code: 1001 1111

Complement: 1010 0000

2. Conversion between binary number and octal, decimal, and hexadecimal numbers

Eg: for-10

The original code: three steps, absolute value, reverse, and finally add 1. So the original code: 1111 0110

Anti-code: The original code is the highest bit unchanged, the remaining bits are reversed: 1000 1001

Complement: The highest position is unchanged, the remaining bits are reversed and the last one is added: 1111 01111

The conversion between the rest of the binary and octal, decimal, and hexadecimal is similar to the conversion between binary and decimal.

    

    

Java Review (1)

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.