code: public static int searchLast(char[] charArray, char value, int occurrence) {
          if(occurrence <= 0 || occurrence > charArray.length) {
              throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
                      + "the array length: " + occurrence);
          }
  
          int valuesSeen = 0;
  
          for(int i = charArray.length-1; i >=0; i--) {
              if(charArray[i] == value) {
                  valuesSeen++;
  
                  if(valuesSeen == occurrence) {
                      return i;
                  }
              }
          }
  
          return -1;
      }
docs: Search for the value in the char array and return the index of the first occurrence from the
  end of the array.
  
  @param charArray array that we are searching in.
  @param value value that is being searched in the array.
  @param occurrence number of times we have seen the value before returning the index.
  
  @return the index where the value is found in the array, else -1.