@param s the string to parse for the integer value @throws IllegalArgumentException if s is empty @throws NumberFormatException see Integer#parseInt(String)
(String s)
| 305 | * @throws NumberFormatException see {@link Integer#parseInt(String)} |
| 306 | */ |
| 307 | static int atoi(String s) throws NumberFormatException { |
| 308 | if (s == null || s.length() < 1) |
| 309 | throw new IllegalArgumentException("Can't convert empty string to integer"); |
| 310 | // Integer.parseInt doesn't accept '+' prefixed strings |
| 311 | if (s.charAt(0) == '+') |
| 312 | s = s.substring(1); |
| 313 | return Integer.parseInt(s); |
| 314 | } |
| 315 | |
| 316 | /** |
| 317 | * Loads the model from inputReader. |
no outgoing calls