Here you can find the source of toFloat(Object obj)
static Float toFloat(Object obj)
//package com.java2s; public class Main { static Float toFloat(Object obj) { if (obj instanceof String) return Float.valueOf((String) obj); if (obj instanceof Byte) { Byte b = (Byte) obj; return b.floatValue(); }/*from w ww .j av a 2 s.co m*/ if (obj instanceof Short) { Short s = (Short) obj; return s.floatValue(); } if (obj instanceof Integer) { Integer i = (Integer) obj; return i.floatValue(); } if (obj instanceof Long) { Long l = (Long) obj; return l.floatValue(); } return (Float) obj; } }