cara memeriksa pengecualian format nomor di java

try {
    int i = Integer.parseInt(s);
    // s is a valid integer
}
catch (NumberFormatException e) {
    // s is not a valid integer
}
Itchy Ibex