Java Float toHexString() MethodThe toHexString() method of Java Float class returns a hexadecimal string corresponding to the argument passed(float argument). The result is:
Syntax:Parameters:f - This is the float argument to be converted. Return Value:The toHexString() method returns a hex string illustration of the float argument. Example 1Test it NowOutput: 1. Hex String = 0x1.dd8654p22 2. Hex String = -0x1.9e66fp22 3. Hex String = 0x1.f9f7f8p-1 Example 2Test it NowOutput: 1. 1.4E-45 converted to HexString = 0x0.000002p-126 2. 3.4028235E38 converted to HexString = 0x1.fffffep127 3. NaN converted to HexString = NaN 4. Infinity converted to HexString = Infinity 5. -Infinity converted to HexString = -Infinity Example 3Test it NowOutput: Error:(5, 37) java: incompatible types: java.lang.String cannot be converted to java.lang.Float
Next TopicJava Float
|