public static Integer parse ( String str ) throws NumberFormatException { // Return null if no value provided if ( str == null || str . isEmpty ( ) ) return null ; // Parse as integer return Integer . valueOf ( str ) ; }
Parses the given string as an integer where the given string is in the format required by a numeric field .