question: public static float asFloat ( String str , float def ) { try { return Float . parseFloat ( str ) ; } catch ( NumberFormatException e ) { return def ; } }
target:  Parse string to float, if string can't be parsed to float, then it will return given default value.