public int tryGetIndexOfNeededPageInList(long needPageNumber) {
    for (int i = 0; i < pagesInDocument.size(); i++) {
      if (pagesInDocument.get(i).getPageNumber() == needPageNumber) {
        return i;
      }
    }
    return -1;
  }
public int tryGetIndexOfNeededPageInList(long needPageNumber)