public static boolean isNumber(String n) { try { Integer.parseInt(n); } catch (NumberFormatException e) { return false; } return true; }