int (String str) { int sum = 0; for (String part: str.split(" ")) { int b = 0; try { sum = sum + Integer.parseInt(part); b = 1; } catch (NumberFormatException ex) { b = 1; } catch (@Deprecated NullPointerException e){ b = 2; } finally { b = 3; } int c = b; } return sum; }