Home> Java> javaTutorial> body text

What is the value range of java integer

coldplay.xixi
Release: 2020-08-22 10:13:18
Original
5129 people have browsed it

The value range of java integer is from [-2147483648 to 2147483647], including [-2147483648] and [2147483647]. The highest efficiency is when the value is [-128--127].

What is the value range of java integer

java The value range of integer is:

The value of the Integer class is consistent with the value of the int type. The value range is from -2147483648 to 2147483647 (-231 to 231-1), including -2147483648 and 2147483647.

But for the Integer class, in order to improve efficiency, Java initializes integer objects between -128--127, so the Integer class is most efficient when it takes a value of -128--127.

Test:

public class Integertest { public static void main(String[] args) { System.out.println("最大取值:" + Integer.MAX_VALUE); System.out.println("最小取值:" + Integer.MIN_VALUE); } }
Copy after login

Output:

最大取值:2147483647 最小取值:-2147483648
Copy after login

Related learning recommendations:java basic tutorial

The above is the detailed content of What is the value range of java integer. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!