class ArrayUtils {

  public static <T> T getElementAtIndex(T[] array, int index, T defaultValue) {
    try {
      return array[index];
    } catch (ArrayIndexOutOfBoundsException ignore) {
      return defaultValue;
    }
  }

}