Parses the specified string and returns a Short instance if the string can be decoded into a short value. The string may be an optional minus sign "-" followed by a hexadecimal ("0x..." or "#..."), octal ("0..."), or decimal ("...") representation of a short. @param string a stri
(String string)
| 123 | * if {@code string} can not be parsed as a short value. |
| 124 | */ |
| 125 | public static Short decode(String string) throws NumberFormatException { |
| 126 | int intValue = Integer.decode(string).intValue(); |
| 127 | short result = (short) intValue; |
| 128 | if (result == intValue) { |
| 129 | return valueOf(result); |
| 130 | } |
| 131 | throw new NumberFormatException(); |
| 132 | } |
| 133 | |
| 134 | @Override |
| 135 | public double doubleValue() { |