Decodes a String into a Short.
Accepts decimal, hexadecimal, and octal numbers given by
the following grammar:
DecimalNumeral, HexDigits, and OctalDigits are as defined in section 3.10.1 of The Java™ Language Specification, except that underscores are not accepted between digits.
- DecodableString:
- Signopt DecimalNumeral
- Signopt
0xHexDigits- Signopt
0XHexDigits- Signopt
#HexDigits- Signopt
0OctalDigits
- Sign:
-+
The sequence of characters following an optional
sign and/or radix specifier (" 0x", " 0X",
" #", or leading zero) is parsed as by the
Short.parseShort method with the indicated radix (10, 16, or
8). This sequence of characters must represent a positive
value or a NumberFormatException will be thrown. The
result is negated if first character of the specified
String is the minus sign. No whitespace characters are
permitted in the String.
nm | the String to decode. |
Short object holding the short
value represented by nm
NumberFormatException | if the String does not
contain a parsable short. |
Diagram: Number