public int getIntegerProperty ( String key , int defaultValue , int [ ] values ) { String prop = getProperty ( key ) ; int value = defaultValue ; try { if ( prop != null ) { value = Integer . parseInt ( prop ) ; } } catch ( NumberFormatException e ) { } if ( ArrayUtil . find ( values , value ) == - 1 ) { return defaultValue ; } return value ; }
Choice limited to values list defaultValue must be in the values list .