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(Integer i)
to Long
if (i == null) {
    return null;
return i.longValue();
Long[]toLong(long[] array)
Converts primitive long[] array to Long[]
Long[] toArray = (array == null) ? new Long[0] : new Long[array.length];
for (int i = 0; i < toArray.length; i++) {
    toArray[i] = array[i];
return toArray;
LongtoLong(Number n)
to Long
if (n == null) {
    return null;
return n.longValue();
LongtoLong(Number n)
Converts a Number to a Long.
if (n == null) {
    return null;
return n.longValue();
LongtoLong(Number num)
Convert the given number into a Long instance.
return (num == null) ? null : Long.valueOf(num.longValue());
longtoLong(Object _inStrObj)
to Long
if (_inStrObj == null || _inStrObj.toString().trim().equals("")) {
    return 0;
} else {
    return Long.valueOf(_inStrObj.toString()).longValue();
longtoLong(Object _value, long _default)
Converts a string to an integer, and if unable to do so, returns the default value
if (_value == null)
    return _default;
else if (_value instanceof Integer)
    return ((Integer) _value).longValue();
else if (_value instanceof Long)
    return ((Long) _value);
else if (_value instanceof Double)
    return ((Double) _value).longValue();
...
LongtoLong(Object cell)
to Long
if (cell instanceof Long) {
    return ((Long) cell);
} else if (cell instanceof Integer) {
    return new Long((Integer) cell);
} else if (cell instanceof String) {
    return Double.valueOf((String) cell).longValue();
} else {
    return null;
...
LongtoLong(Object expectInt)
to Long
if (expectInt != null) {
    try {
        return ((Number) expectInt).longValue();
    } catch (ClassCastException e) {
        if (expectInt instanceof String) {
            try {
                return Long.parseLong((String) expectInt);
            } catch (NumberFormatException e1) {
...
longtoLong(Object num)
to Long
long x;
if (num instanceof Integer) {
    x = ((Integer) num).longValue();
} else if (num instanceof Double) {
    x = ((Double) num).longValue();
} else {
    x = (long) num;
return x;