Here you can find the source of toFloat(Object obj)
Parameter | Description |
---|---|
obj | the object to be converted |
public static float toFloat(Object obj)
//package com.java2s; public class Main { /**//from w ww .j av a2s . c o m * Get the float value of this object, only if the object is an instance of Number * * @param obj the object to be converted * @return the float value of the object, or 0.0f if it is not a number. */ public static float toFloat(Object obj) { return (obj instanceof Number) ? ((Number) obj).floatValue() : 0.0f; } }