I normally use the following idiom to check if a String can be converted to an integer.
public boolean isInteger( String input ) { try { Integer.
Another option:
private boolean isNumber(String s) { boolean isNumber = true; for (char c : s.toCharArray()) { isNumber = isNumber && Character.isDigit(c); } return isNumber; }