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(Object num, long defValue)
to Long
if (num != null) {
    String value = String.valueOf(num);
    try {
        return Long.parseLong(value);
    } catch (Exception e) {
return defValue;
...
longtoLong(Object number)
to Long
if (number == null) {
    return 0L;
} else if (number instanceof Number) {
    return ((Number) number).longValue();
} else if (number instanceof String) {
    String str = (String) number;
    int isNumber = isNumeric(str);
    return isNumber == 1 ? Long.parseLong(str) : (isNumber == 2 ? Double.valueOf(str).longValue() : 0L);
...
longtoLong(Object o)
to Long
if (o instanceof Byte) {
    return (Byte) o;
} else if (o instanceof Short) {
    return (Short) o;
} else if (o instanceof Integer) {
    return (Integer) o;
} else if (o instanceof Long) {
    return (Long) o;
...
LongtoLong(Object o)
to Long
if (o == null)
    return null;
if (o.getClass() == Long.class)
    return (Long) o;
if (o.getClass() == Boolean.class)
    return booleanToLong((Boolean) o);
if (o.getClass() == Byte.class)
    return (long) ((Byte) o).byteValue();
...
LongtoLong(Object o)
to Long
Long result;
if (o == null) {
    result = null;
} else if (o instanceof Number) {
    Number n = (Number) o;
    result = n.longValue();
} else {
    try {
...
LongtoLong(Object ob, Long defaultLong)
to Long
if (ob == null) {
    return defaultLong;
if (ob instanceof Integer) {
    return ((Integer) ob).longValue();
} else if (ob instanceof Float) {
    return ((Float) ob).longValue();
} else if (ob instanceof Double) {
...
longtoLong(Object obj)
to Long
return Long.parseLong(toString(obj).trim());
LongtoLong(Object obj)
to Long
if (obj instanceof String)
    return Long.parseLong((String) obj);
if (obj instanceof Byte) {
    Byte b = (Byte) obj;
    return b.longValue();
if (obj instanceof Short) {
    Short s = (Short) obj;
...
longtoLong(Object obj)
Convert object returned from server to long.
return (obj != null) ? (Long) obj : 0;
longtoLong(Object obj)
Get the long value of this object, only if the object is an instance of Number
return (obj instanceof Number) ? ((Number) obj).longValue() : 0L;