For example, look at this code:
Integer myInt = new Integer(5);
int i1 = myInt.intValue();
int i2 = myInt;
System.out.println(i1);
System.out.println(i2);
As you can see, I have two ways to copy my integer value from a wrapper to a primitive:
I can use unboxing
OR
I can use intValue () method
So ... what you need to have a method when it is already unpacked?
source
share