Boxing converts the value of a primitive type to an object of a corresponding wrapper class. Unboxing converts the object of a wrapper class to a value of the corresponding primitive type.
Boxing and unboxing between primitive and reference types
Boxing
Boxing a primitive type can be done either automatically (called autoboxing) or explicitly using the valueOf() method available in each wrapper type:
int n = 12;...
Integer integer = n; //an example of autoboxing
System.out.println(integer); //prints: 12
integer = Integer.valueOf(n);
System.out.println(integer); //prints: 12
Byte b = Byte.valueOf((byte)n);
Short s = Short.valueOf((short)n);
Long l = Long.valueOf(n);
Float f = Float.valueOf(n);
Double d = Double.valueOf(n);