List of utility methods to do Integer Create
int | toInteger(long n) to Integer if (n < Integer.MIN_VALUE || Integer.MAX_VALUE < n) { throw new IllegalArgumentException("value out of range: " + n); return (int) n; |
Integer | toInteger(Number n) Converts a Number to an Integer. if (n == null) { return null; return n.intValue(); |
Integer | toInteger(Number n) Converts a Number into an Integer if not already such if (n == null) { return null; } else if (n instanceof Integer) { return (Integer) n; } else { return n.intValue(); |
int | toInteger(Number number) to overcome Exception occur when Integer, Double or other Number object is null when try to do mathematics operation (+-/*) return (int) toDouble(number); |
int | toInteger(Object _inStrObj) to Integer if (_inStrObj == null || _inStrObj.toString().trim().equals("")) { return 0; } else { return new Integer(_inStrObj.toString()).intValue(); |
int | toInteger(Object _value, int _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; else if (_value instanceof Long) return ((Long) _value).intValue(); else if (_value instanceof Double) return ((Double) _value).intValue(); ... |
Integer | toInteger(Object anObj) Converts given value to Integer. if (anObj == null) return null; Integer tmpResult = null; if (anObj instanceof Integer) { tmpResult = (Integer) anObj; } else if (anObj instanceof Number) { tmpResult = new Integer(((Number) anObj).intValue()); } else { ... |
Integer | toInteger(Object cell) to Integer if (cell instanceof Long) { return ((Long) cell).intValue(); } else if (cell instanceof Integer) { return (Integer) cell; } else if (cell instanceof String) { return Integer.parseInt((String) cell); } else { return null; ... |
Integer | toInteger(Object o) to Integer if (o == null) { return null; return Integer.valueOf(String.valueOf(o)); |
Integer | toInteger(Object o) to Integer Integer i; if (o instanceof Integer) { i = (Integer) o; } else { try { i = Integer.valueOf(o.toString()); } catch (Exception e) { i = null; ... |