Integer Class in Java

Integer Class

While programming in Java when we have to store numbers wherever they are floating, binary number or decimal numbers we use simple data types like integer, float, and Boolean etc. we use their relevant data type, i.e. int, double, float etc. and java provides their relevant wrapper classes for instance Integer class which we will discuss today. These classes provide relevant functions for specific operations.


int value = 9;

float value = 9.9;

bool value = 1;

byte value = 0x3af;

double value = 234;

long int value = 345323453;

Sometimes while programming we have to use an object instead of variables so java provides wrapper classes for that purpose.

All the wrapper classes are laid under the main super class number. And when we try to convert that data types into objects this is called boxing. The process of boxing is done by the compiler itself.

And on output when the object is converted back to its primitive form then this process is called unboxing.



Java numbers operations:


this function converts and returns the value to that type for which is is written.


this function takes a value compare with the object from which it is invoked and returns 1 if less than 0 and -1 if greater.



This function takes one value and compares it with the object and return true or false.


this function is used to assign some value to integers.


This function is used to convert the int value to a string.


This function is also used for conversion we discuss this in the following topic.

Type Casting in Java


this function is used to get absolute values of the data type.