java integer最大值与最小值以及变量申明
java integer最大值与最小值以及变量申明
Integer最大值与最小值
一个常数持有最高价值智力所能拥有的31-1 2 ^。
一个常数控股最小值,智力所能拥有的减少2 ^ 31。
public class MainClass {
public static void main(String[] arg) {
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);
}
}
bitCount二进制表现形式
public class MainClass {
public static void main(String args[]) {
int n = 170; // 10101010
System.out.println("Value in binary: 10101010");
System.out.println("Number of one bits: " Integer.bitCount(n));
}
}
Value in binary: 10101010
Number of one bits: 4
申明一个integer变量
public class Main {
public static void main(String[] args) {
Integer intObj1 = new Integer(10);
Integer intObj2 = new Integer("10");
System.out.println(intObj1);
System.out.println(intObj2);
}
}
您可能感兴趣的文章:
java integer最大值与最小值以及变量申明
java常量与变量的学习笔记
GO语言函数与封装(package,function) 学习总结教程
php入门教程-php变量
golang 初始化并赋值_Golang | 既是接口又是类型,interface是什么神仙用法?
java中”==”和”Equal”的区别
mysql 数据库unsigned的用法
php中常量与变量的区别是什么?
php八大数据类型有哪些
PHP变量详解和定义变量名的方法