int类型的整数能够表示的最大数字

1. Int类型的整数能够表示的最大数字是2147483647,因为int类型可以表示4个字节所以有32位二进制为1,下面是具体的代码测试

public class Main {
	public static void main(String[] args) {
		int u = 1;
		for(int i = 0; i <= 30; i++){
			u *= 2;
		}
		System.out.println(u - 1 + " " + Integer.MAX_VALUE);
		//System.out.println(Long.MAX_VALUE);
	}
}

猜你喜欢

转载自blog.csdn.net/qq_39445165/article/details/88408432
今日推荐