code: public static float parseFloat(String val, float defVal){
          if(TextUtils.isEmpty(val)) return defVal;
          try{
              return Float.parseFloat(val);
          }catch (NumberFormatException e){
              return defVal;
          }
      }
docs: Parse a float from a String in a safe manner.
  
  @param val           the string to parse
  @param defVal        the default value to return if parsing fails
  @return              the parsed float, or default value