A method, by by Character.isDigit () to determine
public static void main(String[] args) { String content = "123"; boolean checkFlag = true; for(int i=0;i<content.length();i++){ if(!Character.isDigit(content.charAt(i))){ checkFlag = false; } } System.out.println(checkFlag); }
The second method is determined by the regular expression \ d +