How would you check if a String was a number before parsing it?
You can use the java.util.Scanner object.
public static boolean isNumeric(String inputData) { Scanner sc = new Scanner(inputData); return sc.hasNextInt(); }