Java Utililty Methods Integer Create

List of utility methods to do Integer Create

Description

The list of methods to do Integer Create are organized into topic(s).

Method

IntegertoInteger(Object ob, Integer defaultInteger)
to Integer
if (ob == null) {
    return defaultInteger;
if (ob instanceof Integer) {
    return ((Integer) ob).intValue();
} else if (ob instanceof Float) {
    return ((Float) ob).intValue();
} else if (ob instanceof Double) {
...
IntegertoInteger(Object obj)
to Integer
if (obj instanceof String)
    return Integer.parseInt((String) obj);
if (obj instanceof Byte) {
    Byte b = (Byte) obj;
    return b.intValue();
if (obj instanceof Short) {
    Short s = (Short) obj;
...
inttoInteger(Object obj)
Get the integer value of this object, only if the object is an instance of Number
return (obj instanceof Number) ? ((Number) obj).intValue() : 0;
inttoInteger(Object obj)
Converts an Object to an int.
Integer result = toIntegerObject(obj);
return result == null ? 0 : result.intValue();
IntegertoInteger(Object object)
to Integer
Integer integerValue;
if (object instanceof String) {
    integerValue = Integer.valueOf((String) object);
} else if (object instanceof Number) {
    integerValue = ((Number) object).intValue();
} else if (object == null) {
    integerValue = null;
} else {
...
IntegertoInteger(Object object)
to Integer
Integer l = null;
if (object != null) {
    if (object instanceof Integer)
        l = (Integer) object;
    else if (object instanceof String)
        l = Integer.valueOf((String) object);
return l;
...
inttoInteger(Object object, int defaultValue)
Extract the value represented by the given object (Number or String).
if (object == null) {
    return defaultValue;
if (object instanceof Number) {
    return ((Number) object).intValue();
try {
    Double value = Double.valueOf(object.toString().trim());
...
IntegertoInteger(Object object, Integer defaultValue)
to Integer
if (object == null) {
    return defaultValue;
if (object instanceof Number) {
    return ((Number) object).intValue();
try {
    Double value = Double.valueOf(object.toString().trim());
...
inttoInteger(Object str)
to Integer
return str == null ? 0 : str instanceof Number ? ((Number) str).intValue() : toInteger(str.toString());
IntegertoInteger(Object val)
to Integer
return toLong(val).intValue();