Double.toHexString(): This method is available in java.lang.Double class of Java.
Syntax:
String java.lang.Double.toHexString(double d)
This method takes one argument of type double as its parameter. This method returns a hexadecimal string representation of the double argument.
Note:
1. If the argument is NaN, the result is the string"NaN".
2. Otherwise, the result is a string that represents the sign and magnitude of the argument.
Parameters: One parameter is required for this method.
d: the double to be converted.
Returns: a hex string representation of the argument.
For Example:
double d = 19919.6
Double.toHexString(d) = > It returns 0x1.373e666666666p14
Approach
Java
public class DoubletoHexString {public static void main(String[] args) {double d = 19919.6;System.out.println(Double.toHexString(d));}}
Output:
0x1.373e666666666p14
No comments:
Post a Comment