code: public static boolean endsWith(final String value, final String search, final int position,
                                     final boolean caseSensitive) {
          validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
          int remainingLength = position - search.length();
          if (caseSensitive) {
              return value.indexOf(search, remainingLength) > -1;
          }
          return value.toLowerCase().indexOf(search.toLowerCase(), remainingLength) > -1;
      }
docs: Test if value ends with search.
  
  @param value         input string
  @param search        string to search
  @param position      position till which you want to search.
  @param caseSensitive true or false
  @return true or false