code: public static float coerceToFloat(Object value, float defaultValue) {
      if (value instanceof Float) {
        return (float) value;
      }
      if (value instanceof Number) {
        return ((Number) value).floatValue();
      } else if (value instanceof String) {
        try {
          return Float.valueOf((String) value);
        } catch (NumberFormatException ignored) {
        }
      }
      return defaultValue;
    }
docs: Returns the float representation at {@code value} if it exists and is a float or can be coerced
  to a float. Returns {@code defaultValue} otherwise.