Because it accepts hexadecimal values, and you pass the actual hexadecimal value.
From Doc (s = String input argument)
s must be a FloatValue, as described in the lexical syntax of the rule:
FloatValue: Signopt NaN Signopt Infinity Signopt FloatingPointLiteral Signopt HexFloatingPointLiteral SignedInteger HexFloatingPointLiteral: HexSignificand BinaryExponent FloatTypeSuffixopt HexSignificand: HexNumeral HexNumeral . 0x HexDigitsopt . HexDigits 0X HexDigitsopt . HexDigits BinaryExponent: BinaryExponentIndicator SignedInteger BinaryExponentIndicator: p P
about NumberFormatException selected from valueOf
where Sign, FloatingPointLiteral, HexNumeral, HexDigits, SignedInteger and FloatTypeSuffix are defined in the sections of the lexical structure of the Java Language Specification. If s does not have a form from FloatValue, then a NumberFormatException is thrown.
About using p in hexadecimal: P in the declaration of constants
source share