public float optFloat ( int index , float defaultValue ) { final Number val = this . optNumber ( index , null ) ; if ( val == null ) { return defaultValue ; } final float floatValue = val . floatValue ( ) ; // if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) { // return floatValue; // } return floatValue ; }
Get the optional float value associated with an index . The defaultValue is returned if there is no value for the index or if the value is not a number and cannot be converted to a number .