Decode a string and return an integer value

ReturnMethodSummary
static Integerdecode(String nm)Decodes a String into an Integer.

decode(String nm) 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(Integer.decode("010"));

  }
}

The output:


8
java2s.com  |  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.