Parse long value from string
static long parseLong(String s)
- Parses the string argument as a signed decimal long.
static long parseLong(String s, int radix)
- Parses the string argument as a signed long in the radix.
static Long valueOf(long l)
- Returns a Long instance representing the specified long value.
static Long valueOf(String s)
- Returns a Long object holding the value of the specified String.
static Long valueOf(String s, int radix)
- Returns a Long holding the value from the String with the radix.
public class Main {
public static void main(String[] args) {
System.out.println(Long.parseLong("12345"));
}
}
The output:
12345
To convert or parse string with radix,
public class Main {
public static void main(String[] args) {
System.out.println(Long.parseLong("10",8));
}
}
The output:
8
Home
Java Book
Essential Classes
Java Book
Essential Classes
Long:
- Long class
- Constants value from Long class
- Constructors from Long
- Convert long value to byte, double, float, int, long, short
- Decode a string to create long value
- Get the long value from a system property
- Compare two long values
- Parse long value from string
- Convert long value to binary, hex and octal format strings
- Convert long value to string
- Get the sign of the long value
- Get the number of zero bits preceding and following
- Reverse and rotate a long value