private static @Nullable Page pageOrNull(Page[] pages,
                                           int pageIndex) {
    if (0 <= pageIndex && pageIndex < pages.length) {
      return pages[pageIndex];
    }
    return null;
  }
private static @Nullable Page pageOrNull(Page[] pages,
                                           int pageIndex)