List of utility methods to do Integer Create
Integer | toInt(Object o) to Int if (o == null) return new Integer(0); return Integer.valueOf(o.toString()); |
int | toInt(Object o, int defaultValue) to Int if (o == null) return defaultValue; if (o.getClass() == Integer.class) return (Integer) o; if (o.getClass() == Boolean.class) return booleanToInt((Boolean) o); if (o.getClass() == Byte.class) return (int) ((Byte) o).byteValue(); ... |
int | toInt(Object obj) This method convert object to int. int value = 0; if (obj != null) { String objVal = String.valueOf(obj); if (objVal.length() > 0) { Integer intObj = Integer.parseInt(objVal); value = intObj.intValue(); return value; |
int | toInt(Object obj) to Int return toInt(obj, 0);
|
int | toInt(Object obj) to Int String str = obj != null ? obj.toString().trim() : ""; return "".equals(str) ? 0 : Integer.parseInt(str); |
int | toInt(Object obj) Convert object returned from server to int. return (int) toLong(obj); |
int | toInt(Object obj) to Int int a = 0; try { if (obj != null) a = Integer.parseInt(obj.toString()); } catch (Exception e) { return a; |
int | toInt(Object obj) to Int Integer i = toInteger(obj); if (i != null) { return i.intValue(); return 0; |
int | toInt(Object obj) to Int int value = 0; if (obj == null) return value; else { Integer intObj = (Integer) obj; value = intObj.intValue(); return value; |
int | toInt(Object object) to Int return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt(object.toString()); |