Java - Write code to check if a string is all Digit via char array

Requirements

Write code to check if a string is all Digit via char array

Demo

public class Main {
  public static void main(String[] argv) {
    String str = "book2s.com";
    System.out.println(isDigit(str));
  }//from   ww w  . ja  va  2 s .  co  m

  public static boolean isDigit(String str) {
    if (isNotNull(str)) {
      for (char c : str.toCharArray()) {
        if ((c < '0' || c > '9'))
          return false;
      }
    } else {
      return false;
    }
    return true;
  }

  public static boolean isNotNull(String str) {
    if (null != str && !"".equals(str)) {
      return true;
    } else {
      return false;
    }
  }
}