code: static long getNextLogSequenceNumberToCheckpoint(UfsJournal journal) throws IOException {
      List<UfsJournalFile> checkpoints = new ArrayList<>();
      UfsStatus[] statuses = journal.getUfs().listStatus(journal.getCheckpointDir().toString());
      if (statuses != null) {
        for (UfsStatus status : statuses) {
          UfsJournalFile file = UfsJournalFile.decodeCheckpointFile(journal, status.getName());
          if (file != null) {
            checkpoints.add(file);
          }
        }
        Collections.sort(checkpoints);
      }
      if (checkpoints.isEmpty()) {
        return 0;
      }
      return checkpoints.get(checkpoints.size() - 1).getEnd();
    }
docs: Gets the first journal log sequence number that is not yet checkpointed.
  
  @return the first journal log sequence number that is not yet checkpointed