code: protected int getFirstIndexOfConflictingTerm(int start_index, int conflicting_term) {
          Log log=raft.log_impl;
          int first=Math.max(1, log.firstAppended()), last=log.lastAppended();
          int retval=Math.min(start_index, last);
          for(int i=retval; i >= first; i--) {
              LogEntry entry=log.get(i);
              if(entry == null || entry.term != conflicting_term)
                  break;
              retval=i;
          }
          return retval;
      }
docs: Finds the first index at which conflicting_term starts, going back from start_index towards the head of the log