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].
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); } }
Output:
最大取值:2147483647 最小取值:-2147483648
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!