BigInteger floatValue() Method in Java Last Updated : 04 Dec, 2018 Comments Improve Suggest changes Like Article Like Report 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 conversion can lose information about the precision of the BigInteger value. Syntax: public float floatValue() Returns: The method returns a float value which represents float value for this BigInteger. Examples: Input: BigInteger1=32145 Output: 32145.0 Explanation: BigInteger1.floatValue()=32145.0. Input: BigInteger1=32145535361361525377 Output: 3.2145535E19 Explanation: BigInteger1.floatValue()=3.2145535E19. This BigInteger 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. Below programs illustrate floatValue() method of BigInteger class: Example 1: Java // Java program to demonstrate floatValue() method of BigInteger import java.math.BigInteger; public class GFG { public static void main(String[] args) { // Creating 2 BigInteger objects BigInteger b1, b2; b1 = new BigInteger("32145"); b2 = new BigInteger("7613721"); // apply floatValue() method float floatValueOfb1 = b1.floatValue(); float floatValueOfb2 = b2.floatValue(); // print floatValue System.out.println("floatValue of " + b1 + " : " + floatValueOfb1); System.out.println("floatValue of " + b2 + " : " + floatValueOfb2); } } Output: floatValue of 32145 : 32145.0 floatValue of 7613721 : 7613721.0 Example 2: When return float is too big for a magnitude to represent as a float. Java // Java program to demonstrate floatValue() method of BigInteger import java.math.BigInteger; public class GFG { public static void main(String[] args) { // Creating 2 BigInteger objects BigInteger b1, b2; b1 = new BigInteger("32145535361361525377"); b2 = new BigInteger("7613721535372632367351"); // apply floatValue() method float floatValueOfb1 = b1.floatValue(); float floatValueOfb2 = b2.floatValue(); // print floatValue System.out.println("floatValue of " + b1 + " : " + floatValueOfb1); System.out.println("floatValue of " + b2 + " : " + floatValueOfb2); } } Output: floatValue of 32145535361361525377 : 3.2145535E19 floatValue of 7613721535372632367351 : 7.6137214E21 Reference: https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#floatValue() Comment More infoAdvertise with us Next Article BigInteger floatValue() Method in Java A AmanSingh2210 Follow Improve Article Tags : Java java-basics Java-Functions java-math Java-BigInteger Java-math-package +2 More Practice Tags : JavaJava-BigInteger Similar Reads BigInteger doubleValue() Method in Java The java.math.BigInteger.doubleValue() converts this BigInteger to a double value. If the value return by this function is too big for a magnitude to represent as a double then it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate. There is a chance that this co 2 min read 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 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 BigInteger or() method in Java Prerequisite: BigInteger Basics The java.math.BigInteger.or(BigInteger val) method is used to perform bitwise OR of two BigIntegers. One of the BigInteger is passed in parameter and the other on which the function is called. This method returns a negative number if either of the BigIntegers used wit 2 min read BigInteger and() Method in Java The java.math.BigInteger.and(BigInteger val) method returns a BigInteger whose value is bitwise-AND of two BigIntegers. This method returns a negative number if both of the BigIntegers are negative. The and() method applies bitwise-AND operation upon the current bigInteger and bigInteger passed as p 2 min read AtomicInteger floatValue() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.floatValue() is an inbuilt method in java which returns the current value of the AtomicInteger as a Float data-type after performing primitive conversion. Syntax: public float floatValue() Parameters: The function does not accepts any parameter. Return v 1 min read Byte floatValue() method in Java with examples The floatValue() method of Byte class is a built in method in Java which is used to return the value of this Byte object as float. Syntax ByteObject.floatValue() Return Value: It return the value of ByteObject as float. Below is the implementation of floatValue() method in Java: Example 1: Java // J 2 min read BigDecimal floatValue() Method in Java with Examples The java.math.BigDecimal.floatValue() converts this BigDecimal to a float. If this BigDecimal has too great magnitude to represent as a float, it will be converted to Float.NEGATIVE_INFINITY or Float.POSITIVE_INFINITY as appropriate. Note that even when the return value is finite, this conversion ca 2 min read BigInteger divide() Method in Java with Examples The java.math.BigInteger.divide(BigInteger val) is used to calculate the division of two BigIntegers. BigInteger class internally uses array of integers for processing, the operation on object of BigIntegers are not as fast as on primitives. This method performs an operation upon the current BigInte 3 min read BigInteger add() Method in Java with Examples The java.math.BigInteger.add(BigInteger val) is used to calculate the Arithmetic sum of two BigIntegers. This method is used to find arithmetic addition of large numbers of range much greater than the range of biggest data type double of java without compromising with the precision of the result. Th 3 min read Like