string to int without parseint java code example
Example 1: java check if able to parse int
public static boolean isParsable(String input) {
try {
Integer.parseInt(input);
return true;
} catch (final NumberFormatException e) {
return false;
}
}
Example 2: parse string to int java
String number = "10";
int result = Integer.parseInt(number);
System.out.println(result);