Create a method that will throw an exception:
private void checkBounds(int index) throws IndexException {
if (index < 0 || index >= info.length) {
throw new IndexException();
}
}
You can then call it:
public R get(int index) throws IndexException {
checkBounds(index);
return this.info[index];
}
public void set(int index, R r) throws IndexException {
checkBounds(index);
this.info[index] = r;
}