Optional lesson — beyond the AP CS A exam. Catching exceptions with try/catch is not on the AP exam (which only declares throws); this is here for a fuller picture of Java.
Throwing your own exceptions
You can throw an exception yourself to signal bad input, using throw new IllegalArgumentException("message"). This stops the method and hands the error to a caller's catch — a clean way to reject invalid arguments.