Here you can find the source of toFloatByObject(Object obj)
public static Float toFloatByObject(Object obj)
//package com.java2s; //License from project: Apache License public class Main { public static Float toFloatByObject(Object obj) { try {//from ww w. j a v a2 s. c om return Float.valueOf(toStringByObject(obj, true)); } catch (Exception e) { return 0.0f; } } public static String toStringByObject(Object obj) { return toStringByObject(obj, false); } public static String toStringByObject(Object obj, boolean isqdkg) { if (obj == null) { return ""; } else { if (isqdkg) { return obj.toString().trim(); } else { return obj.toString(); } } } }