Java Utililty Methods Object to Long

List of utility methods to do Object to Long

Description

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

Method

LongcastLong(Object o)
cast Long
Long value = null;
if (o != null) {
    value = Long.parseLong(o.toString());
return value;
LongcastLong(Object o)
Casts a value to a double.
if (o == null) {
    return null;
if (o instanceof Number) {
    return ((Number) o).longValue();
} else {
    try {
        return Long.valueOf(o.toString());
...
longcastLong(Object val)
cast Long
return (val instanceof String) ? Long.parseLong(val.toString().trim()) : ((Number) val).longValue();
intcastLong2Int(long x)
cast Long Int
if (x >= Integer.MAX_VALUE) {
    return Integer.MAX_VALUE;
} else if (x <= Integer.MIN_VALUE) {
    return Integer.MIN_VALUE;
return (int) x;
intcastLongtoUInt(long x)
cast Longto U Int
return (int) (x & 0x00000000ffffffffL);
LongcastToLong(final String uid)
cast To Long
try {
    return Long.decode(uid);
} catch (NumberFormatException nfe) {
    return null;
LongcastToLong(Object object)
Sometimes ELP's version of cast is misbehaving
if (object != null) {
    if (object instanceof Long)
        return (Long) object;
    else
        return Long.valueOf(object.toString());
return null;
LongcastToLong(Object value)
cast To Long
if (value == null) {
    return null;
if (value instanceof Number) {
    return ((Number) value).longValue();
if (value instanceof String) {
    String strVal = (String) value;
...
LongcastToLong(Object value)
cast To Long
return (Long) value;
Long[]castToLongArray(Object[] array)
EPL has embedded cast method, but it doesn't cover arrays
if (array != null) {
    Long[] retArray = new Long[array.length];
    int i = 0;
    for (Object element : array) {
        retArray[i] = element == null ? null : (Long) element;
        i++;
    return retArray;
...