I normally use the following idiom to check if a String can be converted to an integer.
public boolean isInteger( String input ) { try { Integer.
There is guava version:
import com.google.common.primitives.Ints; Integer intValue = Ints.tryParse(stringValue);
It will return null instead of throwing an exception if it fails to parse string.