Notes
Integer Class contains methods for the Integer primitive data type.
valueof():
Returns an Integer that contains the value of the specified String.
String myTxt ='12';
Integer myInt = Integer.valueOf(myTxt);
System.debug(myInt);
DEBUG | 12
String txt1 ='12';
String txt2 ='15';
Integer int1 = Integer.valueOf(txt1);
Integer int2 = Integer.valueOf(txt2);
System.debug(int1+int2);
DEBUG | 27
format():
Returns the integer as a string using the locale of the context user.
integer myInt = 22;
String myText = myInt.format();
System.debug(myText);
integer int1 = 12;
integer int2 = 13;
String txt1 = int1.format();
String txt2 = int2.format();
System.debug(txt1 + txt2);