public static Float asFloat(String str){
  try {
    return Float.valueOf(str);
  }
 catch (  NumberFormatException e) {
    return null;
  }
}

public static Float asFloat ( String str ) { try { return Float . valueOf ( str ) ; } catch ( NumberFormatException e ) { return null ; } }
parse string to float , if string can ' t be parsed to float , then it will return null .
