code: static int lastIndexOf(
          String source, int sourceOffset, int sourceCount,
          String target, int targetOffset, int targetCount, 
          int startIndex, IntBinaryOperator comparator)
      {
          int fromIndex = startIndex;
          
          // Adapted from String#lastIndexOf
          int rightIndex = sourceCount - targetCount;
          if (fromIndex < 0)
          {
              return -1;
          }
          if (fromIndex > rightIndex)
          {
              fromIndex = rightIndex;
          }
          if (targetCount == 0)
          {
              return fromIndex;
          }
  
          int strLastIndex = targetOffset + targetCount - 1;
          char strLastChar = target.charAt(strLastIndex);
          int min = sourceOffset + targetCount - 1;
          int i = min + fromIndex;
  
          startSearchForLastChar: while (true)
          {
              while (i >= min && 
                  comparator.applyAsInt(source.charAt(i), strLastChar) != 0)
              {
                  i--;
              }
              if (i < min)
              {
                  return -1;
              }
              int j = i - 1;
              int start = j - (targetCount - 1);
              int k = strLastIndex - 1;
  
              while (j > start)
              {
                  if (comparator.applyAsInt(
                          source.charAt(j--), target.charAt(k--)) != 0)
                  {
                      i--;
                      continue startSearchForLastChar;
                  }
              }
              return start - sourceOffset + 1;
          }
      }
docs: Returns the index of the previous appearance of the given range of the
  target in the given range of the source, source, starting at the
  given index, using the given comparator for characters. Returns -1 if
  the target string is not found.
  
  @param source The source string
  @param sourceOffset The source offset
  @param sourceCount The source length
  @param target The target string
  @param targetOffset The target offset
  @param targetCount The target length
  @param startIndex The start index
  @param comparator The comparator
  @return The index