How would you check if a String was a number before parsing it?
To match only positive base-ten integers, that contains only ASCII digits, use:
public static boolean isNumeric(String maybeNumeric) { return maybeNumeric != null && maybeNumeric.matches("[0-9]+"); }