Java Short.decode(String nm)
Syntax
Short.decode(String nm) has the following syntax.
public static Short decode(String nm) throws NumberFormatException
Example
In the following code shows how to use Short.decode(String nm) method.
public class Main {
public static void main(String[] args) {
// w w w.ja v a 2s. c o m
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: