Integer floatValue() Method in Java Last Updated : 03 May, 2022 Comments Improve Suggest changes Like Article Like Report floatValue() method of Integer class present inside java.lang package is used to convert the value of the given Integer to a float type after a widening primitive conversion which in general is mostly applicable when we want to truncate or rounding-off the integer value. The package view is as follows: --> java.lang Package --> Integer Class --> floatValue() Method Syntax: public float floatValue() Return Type: A numeric value represented by this object after converting it to type float. Note: This method is workable when it is supported by java version 1.2 or onwards, so make sure to update java version if running on older(introductory) java versions. Example 1: java // Java Program to Demonstrate floatValue() Method // of Integer Class // Importing required classes import java.lang.Integer; // Class class GFG { // Main driver method public static void main(String args[]) { // Creating a custom integer by // creating object of Integer class Integer a = new Integer(28); // Converting Integer number to float value // using floatValue() method float b = a.floatValue(); // Printing the float value System.out.println(b); } } Output: Example 2: Java // Java Program to Demonstrate Working of floatValue() // Method of Integer Class // Importing required class import java.lang.Integer; // Class class GFG { // Main driver method public static void main(String args[]) { // Creating a custom integer value by // declaring object of Integer Class Integer a = new Integer(20); // Convert Integer number to float value // using floatValue() method float b = a.floatValue(); // Printing the float value on console System.out.println(b); } } Output: Comment More infoAdvertise with us Next Article Integer floatValue() Method in Java N Niraj_Pandey Follow Improve Article Tags : Java Practice Tags : Java Similar Reads Integer doubleValue() Method in Java The doubleValue() method of Integer class of java.lang package is used to convert the value of the given Integer to a Double type after a widening primitive conversion and returns it. Syntax: public double doubleValue() Parameters: The method does not take any parameter. Return Value: This method re 1 min read Java Integer byteValue() Method The byteValue() method of Integer class of java.lang package converts the given Integer into a byte after a narrowing primitive conversion and returns it (value of integer object as a byte). Also, remember this method does override byteValue() method of the Number class. The package view is as follo 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 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 Java Integer compare() method The compare() method of Integer class of java.lang package compares two integer values (x, y) given as a parameter and returns the value zero if (x==y), if (x < y) then it returns a value less than zero and if (x > y) then it returns a value greater than zero. Syntax : public static int compar 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 Java Integer compareTo() method The compareTo() method of Integer class of java.lang package compares two Integer objects numerically and returns the value 0 if this Integer is equal to the argument Integer; a value less than 0 if this Integer is numerically less than the argument Integer; and a value greater than 0 if this Intege 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 intValue() Method in Java 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: publ 3 min read Month getValue() method in Java The getValue() method is a built-in method of the Month ENUM which is used to get the value of the month-of-year from this Month instance as an integer. The value returned by this method is in the range of 1-12, representing months from January to December. Syntax: public int getValue() Parameters: 1 min read Like