private static Integer toInt(String string) {
    if ((string == null) || string.isEmpty()) {
      return null;
    } else {
      try {
        return Integer.parseInt(string);
      } catch (NumberFormatException e) {
        return null;
      }
    }
  }
Translates a String containing an integer value to an Integer.
<p/>
If the string is null, empty or not a number, returns null; otherwise returns an Integer value
representing the integer value of the string.

@param string the string to parse
@return an Integer or null
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java