Java integer maximum and minimum values and variable declaration
Integer maximum and minimum
A constant holds the highest value of intelligence can possess 31-1 2 ^.
A constant holds the minimum value, and the intelligence can be reduced by 2 ^ 31.
Public class MainClass {
Public static void main (String [] arg ){
System. out. println (Integer. MAX_VALUE );
System. out. println (Integer. MIN_VALUE );
}
}
BitCount binary representation
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
Declare an integer variable
Public class Main {
Public static void main (String [] args ){
Integer required bj1 = new Integer (10 );
Integer between bj2 = new Integer ("10 ");
System. out. println (required bj1 );
System. out. println (ipvbj2 );
}
}