Here you can find the source of toFloatObject(Object o)
public static Float toFloatObject(Object o)
//package com.java2s; /*!/*from w ww .ja va 2 s . c o m*/ * mifmi-commons4j * https://github.com/mifmi/mifmi-commons4j * * Copyright (c) 2015 mifmi.org and other contributors * Released under the MIT license * https://opensource.org/licenses/MIT */ import java.text.DecimalFormat; public class Main { public static Float toFloatObject(Object o) { if (o == null) { return null; } Float num; if (o instanceof Float) { num = (Float) o; } else if (o instanceof Number) { num = Float.valueOf(((Number) o).floatValue()); } else if (o instanceof Character) { num = Float.valueOf((float) ((Character) o).charValue()); } else if (o instanceof String) { String s = (String) o; if (s.isEmpty()) { num = null; } else { num = Float.valueOf(s); } } else if (o instanceof Boolean) { num = (((Boolean) o).booleanValue()) ? Float.valueOf(1.0F) : Float.valueOf(0.0F); } else if (o instanceof Enum) { num = Float.valueOf((float) ((Enum<?>) o).ordinal()); } else { num = Float.valueOf(o.toString()); } return num; } public static String toString(Number value, String pattern) { if (value == null) { return null; } DecimalFormat df = new DecimalFormat(pattern); return df.format(value); } }