Integer intValue() Method in Java Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report intValue() of Integer class that is present inside java.lang package is an inbuilt method in java that returns the value of this integer as an int which is inherited from Number Class. The package view is as follows: --> java.lang Package --> Integer Class --> intValue() Method Syntax: public int intValue() Return Type: A numeric value that is represented by the object after conversion to the integer type. Note: This method is applicable from java version 1.2 and onwards. Now we will be covering different numbers such as positive, negative, decimal, and even strings. For a positive integerFor a negative numberFor a decimal value and string Case 1: For a positive integer Example: Java // Java Program to Illustrate // the Usage of intValue() method // of Integer class // Importing required class/es import java.lang.*; // Main class public class GFG { // Main driver method public static void main(String[] args) { // Creating object of Integer class inside main() Integer intobject = new Integer(68); // Returns the value of this Integer as an int int i = intobject.intValue(); // Printing the value above stored in integer System.out.println("The integer Value of i = " + i); } } Output: The integer Value of i = 68 Case 2: For a negative number Example: Java // Java program to illustrate the // use of intValue() method of // Integer class of java.lang package // Importing required classes import java.lang.*; // Main class public class GFG { // Main driver method public static void main(String[] args) { // Creating an object of Integer class Integer intobject = new Integer(-76); // Returns the value of this Integer as an int int i = intobject.intValue(); // Printing the integer value above stored on // console System.out.println("The integer Value of i = " + i); } } Output: The integer Value of i = -76 Case 3: For a decimal value and string. Example: Java // Java Program to illustrate // Usage of intValue() method // of Integer class of java.lang package // Importing required classes import java.lang.*; // Main class class GFG { // Main driver method public static void main(String[] args) { // Creating an object of Integer class Integer intobject = new Integer(98.22); // Using intValue() method int i = intobject.intValue(); // Printing the value stored in above integer // variable System.out.println("The integer Value of i = " + i); // Creating another object of Integer class Integer ab = new Integer("52"); int a = ab.intValue(); // This time printing the value stored in "ab" System.out.println("The integer Value of ab = " + a); } } Output: Note: It returns an error message when a decimal value is given. For a string this works fine. Comment More infoAdvertise with us Next Article Integer signum() Method in Java A ankita_chowrasia Follow Improve Article Tags : Java Java-lang package Java-Functions Java-Integer Practice Tags : Java Similar Reads BigInteger intValue() Method in Java The java.math.BigInteger.intValue() converts this BigInteger to an integer value. If the value returned by this function is too big to fit into integer value, then it will return only the low-order 32 bits. Further there is chance that this conversion can lose information about the overall magnitude 2 min read BigDecimal intValue() Method in Java The java.math.BigDecimal.intValue() is an in-built function which converts this BigDecimal to an integer value. This function discards any fractional part of this BigDecimal. If the result of the conversion is too big to be represented as an integer value, the function returns only the lower-order 3 2 min read Integer sum() Method in Java The java.lang.Integer.sum() is a built-in method in java that returns the sum of its arguments. The method adds two integers together as per the + operator. Syntax : public static int sum(int a, int b) Parameter: The method accepts two parameters that are to be added with each other: a : the first i 2 min read Integer decode() Method in Java It is often seen that any integer within (" ") is also considered as string, then it is needed to decode that into the integer. The main function of java.lang.Integer.decode() method is to decode a String into an Integer. The method also accepts decimal, hexadecimal, and octal numbers. Syntax : publ 2 min read Integer signum() Method in Java The signum function is an odd mathematical function that extracts the sign of a real number. The signum function is also known as sign function. The Integer.signum() method of java.lang returns the signum function of the specified integer value. For a positive value, a negative value and zero the me 3 min read Integer hashCode() Method in Java The java.lang.Integer.hashCode() method of Integer class in Java is used to return the hash code for a particular Integer . Syntax: public int hashCode() Parameters : The method does not take any parameters. Return Value: The method returns a hash code integer value for this object, which is equal t 2 min read Like