Decode a string to short value

static Short decode(String nm)
Decodes a String into a Short.

Accepts decimal, hexadecimal, and octal numbers given by the following grammar:

        +/- 0x HexDigits 
        +/- 0X HexDigits 
        +/- # HexDigits 
        +/- 0 OctalDigits

public class Main {
  public static void main(String[] args) {
    System.out.println("Decimal 10:"+Short.decode("10"));
    System.out.println("Octal 10:"+Short.decode("010"));
    System.out.println("Hex F:"+Short.decode("0XF"));
    System.out.println("Negative Hex F:"+Short.decode("-0XF"));

The output:

Decimal 10:10
Octal 10:8
Hex F:15
Negative Hex F:-15
  Java Book 
    Essential Classes  

  1. Short class
  2. Find out the min value, max value and size of Short types
  3. Create Short object with its constructor
  4. Convert Short to byte, double, float, int, long and short
  5. Decode a string to short value
  6. Convert string to a short value
  7. Reverse the bytes in a short
  8. Convert short value to string
  9. Compare two short values