Integer.decode(String nm) has the following syntax.
public static Integer decode(String nm) throws NumberFormatException
In the following code shows how to use Integer.decode(String nm) method.
public class Main { public static void main(String[] args) { System.out.println(Integer.decode("010"));// octal numbers System.out.println(Integer.decode("0XA"));// hexadecimal numbers System.out.println(Integer.decode("-0XA"));// minus hexadecimal numbers System.out.println(Integer.decode("-#A"));// minus hexadecimal numbers } }
The code above generates the following result.