278 * Accepts decimal, hexadecimal, and octal numbers given by
279 * the following grammar:
280 *
281 * <blockquote>
282 * <dl>
283 * <dt><i>DecodableString:</i>
284 * <dd><i>Sign<sub>opt</sub> DecimalNumeral</i>
285 * <dd><i>Sign<sub>opt</sub></i> {@code 0x} <i>HexDigits</i>
286 * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
287 * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
288 * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
289 *
290 * <dt><i>Sign:</i>
291 * <dd>{@code -}
292 * <dd>{@code +}
293 * </dl>
294 * </blockquote>
295 *
296 * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
297 * are as defined in section 3.10.1 of
298 * <cite>The Java™ Language Specification</cite>,
299 * except that underscores are not accepted between digits.
300 *
301 * <p>The sequence of characters following an optional
302 * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
303 * "{@code #}", or leading zero) is parsed as by the {@code
304 * Short.parseShort} method with the indicated radix (10, 16, or
305 * 8). This sequence of characters must represent a positive
306 * value or a {@link NumberFormatException} will be thrown. The
307 * result is negated if first character of the specified {@code
308 * String} is the minus sign. No whitespace characters are
309 * permitted in the {@code String}.
310 *
311 * @param nm the {@code String} to decode.
312 * @return a {@code Short} object holding the {@code short}
313 * value represented by {@code nm}
314 * @throws NumberFormatException if the {@code String} does not
315 * contain a parsable {@code short}.
316 * @see java.lang.Short#parseShort(java.lang.String, int)
317 */
318 public static Short decode(String nm) throws NumberFormatException {
|
278 * Accepts decimal, hexadecimal, and octal numbers given by
279 * the following grammar:
280 *
281 * <blockquote>
282 * <dl>
283 * <dt><i>DecodableString:</i>
284 * <dd><i>Sign<sub>opt</sub> DecimalNumeral</i>
285 * <dd><i>Sign<sub>opt</sub></i> {@code 0x} <i>HexDigits</i>
286 * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
287 * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
288 * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
289 *
290 * <dt><i>Sign:</i>
291 * <dd>{@code -}
292 * <dd>{@code +}
293 * </dl>
294 * </blockquote>
295 *
296 * <i>DecimalNumeral</i>, <i>HexDigits</i>, and <i>OctalDigits</i>
297 * are as defined in section 3.10.1 of
298 * <cite>The Java Language Specification</cite>,
299 * except that underscores are not accepted between digits.
300 *
301 * <p>The sequence of characters following an optional
302 * sign and/or radix specifier ("{@code 0x}", "{@code 0X}",
303 * "{@code #}", or leading zero) is parsed as by the {@code
304 * Short.parseShort} method with the indicated radix (10, 16, or
305 * 8). This sequence of characters must represent a positive
306 * value or a {@link NumberFormatException} will be thrown. The
307 * result is negated if first character of the specified {@code
308 * String} is the minus sign. No whitespace characters are
309 * permitted in the {@code String}.
310 *
311 * @param nm the {@code String} to decode.
312 * @return a {@code Short} object holding the {@code short}
313 * value represented by {@code nm}
314 * @throws NumberFormatException if the {@code String} does not
315 * contain a parsable {@code short}.
316 * @see java.lang.Short#parseShort(java.lang.String, int)
317 */
318 public static Short decode(String nm) throws NumberFormatException {
|