Java Data Type Tutorial - Java Long.decode(String nm)








Syntax

Long.decode(String nm) has the following syntax.

public static Long decode(String nm)   throws NumberFormatException

Example

In the following code shows how to use Long.decode(String nm) method.

The following code decodes a long value in hexadecimal format.

public class Main {
  public static void main(String[] args) {
    Long longObject = Long.decode("0Xff");
    System.out.println(longObject);

  }
}

The output: