Java convert object to float

Java Utililty Methods Object to Float

Method

if ((v < Float.MIN_VALUE) || (v > Float.MAX_VALUE)) < throw new ArithmeticException("Double value is out of Float range: " + v); return (float) v;
try < return Float.parseFloat(uid); > catch (NumberFormatException nfe) < return null;
if (o == null) < return null; if (o instanceof Float) < return (Float) o; try < return Float.valueOf(o.toString()); .
return objectToFloat(obj, 0f);
if (o instanceof Number) return ((Number) o).intValue(); try < if (o == null) return -1; else return Integer.parseInt(o.toString()); > catch (NumberFormatException e) < .
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);
if (null == obj) < return 0; try < if (obj instanceof String) < return Integer.parseInt((String) obj); > else if (obj instanceof Integer) < return (Integer) obj; .
int NumInt = Integer.parseInt(objectToString(Obj)); return NumInt;
if (p1 == null) < return 0; if (p1 instanceof Character) < return (int) ((Character) p1).charValue(); return ((Number) p1).intValue();

Источник

Читайте также:  Cpp function return array
Оцените статью