Maybe you want something like IndexOutOfBoundsException. ThrownIt is thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector)of data is out of range. See https://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html