1, an overview of the integer
Requirement 1: put 100 binary, octal, hexadecimal calculation of this data
Requirement 2: Determine whether a data is within the range of int.
First you need to know how big the int is?
In order to perform more operations on the basic data types and to operate more conveniently, Java provides the corresponding class type for each of the basic data types. The wrapper class Type.
Class type wrapper class type
BYTE byte
Short Short
int Integer
Long Long
float float
Double Double
Char Character
Boolean Boolean
Used for conversions between the base data type and the String.
1 public classIntegerdemo {2 public Static voidmain (string[] Args) {3 //no, The trouble is Coming.4 //public static String tobinarystring (int i)5System.out.println (integer.tobinarystring (100));6 //public static String tooctalstring (int i)7System.out.println (integer.tooctalstring (100));8 //public static String tohexstring (int i)9System.out.println (integer.tohexstring (100));Ten one //public static final int max_value a System.out.println (integer.max_value); - //public static final int min_value - System.out.println (integer.min_value); the } -}
2, the construction method of Integer:
Public Integer (int Value)
Public Integer (String S)
Note: This string must be made up of numeric characters
1 public classIntegerdemo {2 public Static voidmain (string[] Args) {3 //Mode 14 inti = 100;5Integer II =NewInteger (i);6System.out.println ("ii:" +ii);7 8 //Mode 29String s = "100";Ten //NumberFormatException one //String s = "abc"; aInteger III =NewInteger (s); -System.out.println ("iii:" +iii); - } the}
Java 13-3 int type of wrapper package integer