List of utility methods to do Object to Float
float | castToFloat(final double v) Cast Double to Float. if ((v < Float.MIN_VALUE) || (v > Float.MAX_VALUE)) { throw new ArithmeticException("Double value is out of Float range: " + v); return (float) v; |
Float | castToFloat(final String uid) cast To Float try { return Float.parseFloat(uid); } catch (NumberFormatException nfe) { return null; |
Float | objectToFloat(Object o) Convert an object to a Float. if (o == null) { return null; if (o instanceof Float) { return (Float) o; try { return Float.valueOf(o.toString()); ... |
float | objectToFloat(Object obj) object To Float return objectToFloat(obj, 0f);
|
int | objectToInt(Object o) object To Int if (o instanceof Number) return ((Number) o).intValue(); try { if (o == null) return -1; else return Integer.parseInt(o.toString()); } catch (NumberFormatException e) { ... |
int | objectToInt(Object o) object To Int if (o instanceof String) { return Integer.parseInt((String) o); } else if (o instanceof Integer) { return ((Integer) o).intValue(); } else { throw new Exception("Invalid option value " + o); |
int | objectToInt(Object obj) object To Int if (null == obj) { return 0; try { if (obj instanceof String) { return Integer.parseInt((String) obj); } else if (obj instanceof Integer) { return (Integer) obj; ... |
int | objectToInt(Object Obj) object To Int int NumInt = Integer.parseInt(objectToString(Obj)); return NumInt; |
int | objectToInt(Object obj) object To Int return objectToInt(obj, 0);
|
int | objectToInt(Object p1) object To Int if (p1 == null) { return 0; if (p1 instanceof Character) { return (int) ((Character) p1).charValue(); return ((Number) p1).intValue(); |