Java tutorial
//package com.java2s; public class Main { public static boolean isAllDigit(String str) { if (!str.equals("") && str.length() > 0) { int len = 0; for (int idx = 0; idx < str.length(); idx++) { if (Character.isDigit(str.charAt(idx))) { len++; } } if (len == str.length()) { return true; } } return false; } }