public static int toIntWithDefault ( String value , int defaultValue ) { int result = defaultValue ; try { result = Integer . parseInt ( value ) ; } catch ( @ SuppressWarnings ( "unused" ) Exception e ) { // Do nothing, return default. } return result ; }
Parses int value and returns the provided default if the value can t be parsed .