java整数类型取值范围

byte

byte 类型可取的最大值,即 \(2^7-1 \) = 127
byte 类型可取的最小值,即 \(-2^7 \) = -128

short

short 类型可取的最大值,即 \(2^{15}-1 \) = 32767
short 类型可取的最小值,即 \(-2^{15} \) = -32768

int

int 类型可取的最大值,即 \(2^{31}-1 \) = 2147483647
int 类型可取的最小值,即 \(-2^{31} \) = -2147483648

long

long 类型可取的最大值,即 \(2^{63}-1 \) = 9223372036854775807
long 类型可取的最小值,即 \(-2^{63} \) = -9223372036854775808