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

longobjectToLong(Object obj)
object To Long
return objectToLong(obj, 0);
LongobjectToPostiveLong(Object object)
Supports any object which toString method return a positive numeric as String.
if (object == null) {
    return null;
try {
    Long result = Long.parseLong(object.toString());
    if (result >= 0) {
        return result;
    } else {
...
shortobjectToShort(Object o)
object To Short
if (o instanceof Number)
    return ((Number) o).shortValue();
try {
    if (o == null)
        return -1;
    else
        return Short.parseShort(o.toString());
} catch (NumberFormatException e) {
...
shortobjectToShort(Object p1)
object To Short
if (p1 == null) {
    return 0;
if (p1 instanceof Character) {
    return (short) ((Character) p1).charValue();
return ((Number) p1).shortValue();