In Java, each primitive type has a corresponding wrapper class that provides an object representation of the primitive value.
To get the wrapper class for a primitive type, you can use the following methods:
Boolean.valueOf(boolean) for booleanByte.valueOf(byte) for byteShort.valueOf(short) for shortInteger.valueOf(int) for intLong.valueOf(long) for longFloat.valueOf(float) for floatDouble.valueOf(double) for doubleCharacter.valueOf(char) for charFor example, to get the wrapper class for an int value, you can use the following code:
int i = 123; Integer wrapper = Integer.valueOf(i);Source:tual.wwwturi.com
The valueOf method returns an Integer object that wraps the primitive int value.
You can also use the parseInt method of the Integer class to parse a string representation of an int value and return an Integer object:
String str = "123"; Integer wrapper = Integer.parseInt(str);
Note that the wrapper classes are immutable, which means that once you create an object, you cannot modify its value. If you need to modify the value, you can create a new object with the modified value.