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 obj)
to Long
long value = 0;
if (obj != null) {
    String objVal = String.valueOf(obj);
    if (objVal.length() > 0) {
        Long intObj = Long.parseLong(objVal);
        value = intObj.longValue();
return value;
longtoLong(Object obj)
to Long
Long i = toLongAsObject(obj);
if (i != null) {
    return i.longValue();
return 0;
longtoLong(Object obj)
Converts an Object to a long.
Long result = toLongObject(obj);
return result == null ? 0 : result.longValue();
LongtoLong(Object obj)
to Long
if (isNull(obj)) {
    return getNull();
if (obj instanceof Long) {
    return (Long) obj;
if (obj instanceof Integer || obj instanceof Short || obj instanceof Byte) {
    return Long.parseLong(obj.toString());
...
longtoLong(Object obj)
to Long
return toLong(obj, 0L);
LongtoLong(Object obj, String pattern)
to Long
if (obj == null) {
    return null;
} else if (obj instanceof Long) {
    return (Long) obj;
} else if (obj instanceof Number) {
    return Long.valueOf(((Number) obj).longValue());
} else if (obj instanceof String) {
    return toLong((String) obj);
...
LongtoLong(Object object)
to Long
Long l = null;
if (object != null) {
    if (object instanceof Integer)
        l = Long.valueOf(((Integer) object).longValue());
    else if (object instanceof Long)
        l = (Long) object;
    else if (object instanceof String)
        l = Long.valueOf((String) object);
...
LongtoLong(Object object)
to Long
Long longValue;
if (object instanceof String) {
    longValue = (long) Integer.valueOf((String) object);
} else if (object instanceof Number) {
    longValue = (long) ((Number) object).intValue();
} else if (object == null) {
    longValue = null;
} else {
...
longtoLong(Object object)
to Long
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong(object.toString());
longtoLong(Object object)
Lenient convertor -- accepts String or any Number subclass.
if (object == null)
    return 0;
if (object instanceof Number)
    return ((Number) object).longValue();
return Long.valueOf((String) object);