Java Number.floatValue() Method Last Updated : 15 May, 2025 Comments Improve Suggest changes Like Article Like Report The floatValue() method is an inbuilt method in Java from the java.lang.Number class. This method is used when we want to extract the value of a Number object as a float data type. This may involve rounding or truncation, because this method returns the numeric value of the current object converted to float type. The float data type has limited precision that is 32-bit, so, the method may truncate or round the value when converting from a higher precise type like double or long.Syntax of floatValue() Methodpublic abstract float floatValue();Parameters: This method does not accept any parameters. Returns: This method returns the numeric value represented by this object after conversion to type float.This method is very helpful when we work with mixed data types and we want floating-point output from different numeric wrapper classes.Examples of Java Number.floatValue() MethodExample 1: In this example, we are going to convert Integer and Double to float. Java // Java program to demonstrate // floatValue() with Integer and Double import java.lang.Number; public class Geeks { public static void main(String[] args) { // Integer value Integer n1 = new Integer(1785423456); float floatFromInt = n1.floatValue(); System.out.println("Integer to float: " + floatFromInt); // Double value Double n2 = new Double(97854876); float floatFromDouble = n2.floatValue(); System.out.println("Double to float: " + floatFromDouble); } } OutputInteger to float: 1.78542349E9 Double to float: 9.785488E7 Example 2: In this example, we are going to take smaller values with Integer and Double. Java // Java program to demonstrate // floatValue() with smaller values import java.lang.Number; public class Geeks { public static void main(String[] args) { // Integer value Integer n1 = new Integer(456); System.out.println("Integer to float: " + n1.floatValue()); // Double value Double n2 = new Double(96); System.out.println("Double to float: " + n2.floatValue()); } } OutputInteger to float: 456.0 Double to float: 96.0 Important Points:We should be more cautious while using this method because there is a chance of loss of precision. This might happen because we are converting large values or values with high decimal precision. Comment More infoAdvertise with us T Twinkl Bajaj Follow Improve Article Tags : Java Java-lang package Java-Functions Practice Tags : Java Similar Reads Number.floatValue() method in java with examples The floatValue() method is an inbuilt method in Java from the java.lang.Number class. This method is used when we want to extract the value of a Number object as a float data type. This may involve rounding or truncation, because this method returns the numeric value of the current object converted 2 min read Integer floatValue() Method in Java 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 follo 2 min read Number.intValue() method in java with examples The intValue() is an inbuilt method provided by the abstract class java.lang.Number. This method converts a numeric object, such as Float, Double, etc., to an int type. This method may involve rounding or truncation if the original number is a floating-point value.Syntax of Number.intValue() Methodp 2 min read BigInteger floatValue() Method in Java The java.math.BigInteger.floatValue() converts this BigInteger to a float value. If the value returned by this function is too big for a magnitude to represent as a float then it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate. There is a chance that this conve 2 min read Number.byteValue() Method in Java with Examples The Number class in Java is an abstract superclass for numeric wrapper classes like Integer, Float, Double, etc. One of the useful methods provided by this class is byteValue(). The Number.byteValue() method in Java is used when we want to extract the byte representation of a numeric object.The byte 3 min read Like