# It 18 Palm Job _java Foundation second day _ binary conversion principle and complement storage method

Source: Internet
Author: User

1. What is the representation of negative numbers and why is it so designed?

All the numbers in the computer are stored in the form of a complement, with the convenience of plus or minus 0.

The positive and negative numbers add up and overflow the highest bit, which is exactly 0.

How is 2.-128 stored in memory? The calculation process?

-128 in memory is: 10000000

In memory: Positive negation plus 1 is negative

Calculation process:

The binary of 125 is: 01111101-125 for binary: 10000011

The binary of 126 is: 01111110-126 for binary: 10000010

The binary of 127 is: 01111111-127 for binary: 10000001

A rule can be obtained from above.

Negative binary minus 1 to get the next negative number.

Results: 128 of the binary is: 10000000

3. If the byte is represented as 11111111, what is its true data?

The first bit of the byte is the sign bit. 0: Positive 1: Negative.

Therefore, the number is a negative, negative numbers in the form of complement, need to be converted to the original code.

The original code for negative numbers is: complement minus one negation.

The result is: 1

4. Do positive and negative numbers support the complement approach?

are supported.

Both the complement and the inverse of a positive number are themselves.

5. Is the positive number minus one negation?

Yes.

For example:

11111111 is-1:

-1 after: 11111110

Reverse: 00000001

It 18 Palm Job _java Foundation second day _ binary conversion principle and complement storage method

Related Keywords:

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.