Decode a string to create long value

ReturnMethodSummary
static Longdecode(String nm)Decodes a String into a Long.

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) {
    Long longObject = Long.decode("0Xff");
    System.out.println(longObject);

  }
}

The output:


255
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.