Check out example codes for "java test if a string is a int". It will help you in understanding the concepts better.

Code Example 1

public static boolean isInt(String str) {
	
  	try {
      	@SuppressWarnings("unused")
    	int x = Integer.parseInt(str);
      	return true; //String is an Integer
	} catch (NumberFormatException e) {
    	return false; //String is not an Integer
	}
  	
}

Learn ReactJs, React Native from akashmittal.com