The compiler will automatically do the same for unpacking (with JDK 5), therefore
int sum = myint1.intValue() + myint2.intValue();
a little redundant and
int sum = myint1 + myint2;
will have the same behavior.
However, you can parse String directly into int s and avoid both boxing and unpacking:
int myint1 = Integer.parseInt(numberOne); int myint2 = Integer.parseInt(numberTwo); int sum = myint1 + myint2;
source share