public static Integer createInteger(final String str) {
        if (str == null) {
            return null;
        }
        // decode() handles 0xAABD and 0777 (hex and octal) as well.
        return Integer.decode(str);
    }
public static Integer createInteger ( final String str ) { if ( str == null ) { return null ; } return Integer . decode ( str ) ; }
<p>Convert a <code>String</code> to a <code>Integer</code>, handling
hex (0xhhhh) and octal (0dddd) notations.
N.B. a leading zero means octal; spaces are not trimmed.</p>

<p>Returns <code>null</code> if the string is <code>null</code>.</p>

@param str  a <code>String</code> to convert, may be null
@return converted <code>Integer</code> (or null if the input is null)
@throws NumberFormatException if the value cannot be converted