Problems with binary in Java

Source: Internet
Author: User

Tag: IMA indicates a negative number for the specified COM img computer image java

Use the highest bit in the two number to indicate positive or negative.

First you have to know which one is the highest? The 1-byte type, such as the character type, the highest bit is the 7th bit, the number of 2 bytes, the highest bit is the 15th bit, the number of 4 bytes, the highest bit is the 31st bit.

numeric types of different lengths, the highest bits are different, but always the leftmost bit (see below).

The character type is fixed at 1 bytes, so the highest bit is always the 7th bit. (highest bit in red) single-byte number: 1111 1111 double-byte: 1111 1111 1111 11,114 bytes: 1111 1111 1111 1111 1111 1111 1111 1111 When we specify that a quantity is an unsigned type, its highest  Bits of 1 or 0, as with other bits, are used to indicate the size of the number. When we specify that a quantity is a signed type, the highest number is called the sign bit. is 1 o'clock, indicating that the number is a negative value, which is a positive value of 0


In the computer,

Negative

Except for the highest bit

1

, they are also expressed in complementary form.

Problems with binary in Java

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.