code: public static boolean isInteger(String string) {
      if (string == null) {
        return false;
      }
  
      try {
        Integer.parseInt(string);
      } catch (NumberFormatException e) {
        return false;
      }
  
      return true;
    }
docs: Checks whether the given string has an integer value.
  
  @param string the string to check
  @return true if string resembles an integer value, false otherwise