Java Utililty Methods Long Number Create

List of utility methods to do Long Number Create

Description

The list of methods to do Long Number Create are organized into topic(s).

Method

LongtoLong(String value)
to Long
if (value != null && value.length() > 0) {
    try {
        return Long.valueOf(value);
    } catch (NumberFormatException e) {
        return 0L;
return 0L;
...
longtoLong(String value)
to Long
return toLong(value, 0L);
longtoLong(String value)
Converts a given string into type long.
if (isLong(value)) {
    return Long.parseLong(value);
return -1;
longtoLong(String value, long _default)
to Long
if (value == null || value.length() == 0)
    return _default;
return Long.valueOf(value);
longtoLong(String value, long def)
Convert String to long
if (isEmpty(value)) {
    return def;
try {
    return Long.valueOf(value);
} catch (NumberFormatException e) {
    e.printStackTrace();
    return def;
...
longtoLong(String value, Long defaultValue)
to Long
try {
    if (value == null || "".equals(value.trim()))
        return defaultValue;
    value = value.trim();
    if (value.startsWith("N") || value.startsWith("n"))
        return -Long.parseLong(value.substring(1));
    return Long.parseLong(value);
} catch (Exception e) {
...
longtoLong(String value, long defaultValue)
convert the string to an long, and return the default value if the string is null or does not contain a valid int value
if (value != null) {
    try {
        return Long.parseLong(value);
    } catch (NumberFormatException n) {
return defaultValue;
LongtoLong(String value, Long defaultValue)
to Long
if (isEmpty(value))
    return defaultValue;
try {
    return Long.parseLong(value);
} catch (Exception e) {
    return defaultValue;
LongtoLong(T value)
to Long
return (value != null ? value.longValue() : null);
LongtoLongObject(Object o)
to Long Object
if (o == null) {
    return null;
Long num;
if (o instanceof Long) {
    num = (Long) o;
} else if (o instanceof Number) {
    num = Long.valueOf(((Number) o).longValue());
...