Reputation: 517
Is there a simple way to see if an input is an integer in Java?
Upvotes: 0
Views: 1548
Reputation: 96934
try {
Integer.parseInt(myString);
} catch(NumberFormatException e) {
// Not an integer
}
Documentation for parseInt()
if you're interested.
Upvotes: 2