Home > Java > JavaBase > What is the length of java int?

What is the length of java int?

angryTom
Release: 2019-11-18 13:24:56
Original
5819 people have browsed it

What is the length of java int?

What is the length of java int

The value range of int is: -2^31—— 2^31-1, that is -2147483648-2147483647.

1. For a positive number, its complement is itself.

2. For a negative number, its complement is the inversion of all the bits of the binary number corresponding to the positive number plus one.

3. The same operation is used to find the original code from the complement of a negative number (all bits are inverted by 1), which is the absolute value of the negative number.

int is 4 bytes, 32 bits.

10000000 00000000 00000000 00000000 is the complement code, the first bit is the sign bit, 1 represents a negative number, so

negates the remaining bits, the result is 1111111 11111111 11111111 11111111, after adding one It is 10000000 00000000 00000000 00000000

4, so the original code refers to -2^31=-2147483648

php Chinese website, a large number of free Java introductory tutorials, welcome Online Learning!

The above is the detailed content of What is the length of java int?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template