doubleValue(): This method is available in java.math.BigInteger class of Java.
Syntax:
double java.math.BigInteger.doubleValue()
This method converts this BigInteger to a double. This conversion is similar to the narrowing primitive conversion from double to float as defined in The Java Language Specification: if this BigInteger has too great a magnitude to represent as a double, it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate.
Returns: this BigInteger converted to a double.
For Example:
BigInteger bigInteger = new BigInteger("12354")
bigInteger.doubleValue() = > It returns 12354.0
Approach
Java
import java.math.BigInteger;public class BigIntegerdoubleValue {public static void main(String[] args) {BigInteger bigInteger = new BigInteger("12354");System.out.println(bigInteger.doubleValue());}}
Output:
12354.0
No comments:
Post a Comment