SyntaxFix
Write A Post
Hire A Developer
Questions
To avoid handling exceptions use a regular expression to make sure you have all digits first:
//Checking for Regular expression that matches digits if(value.matches("\\d+")) { Integer.parseInt(value); }