code: public String markAfter(@Nullable Dir dir, String str, boolean isHtml) {
      if (dir == null) {
        dir = estimateDirection(str, isHtml);
      }
      // BidiUtils.getExitDir() is called only if needed (short-circuit).
      if (contextDir == Dir.LTR && (dir == Dir.RTL || BidiUtils.getExitDir(str, isHtml) == Dir.RTL)) {
        return BidiUtils.Format.LRM_STRING;
      }
      if (contextDir == Dir.RTL && (dir == Dir.LTR || BidiUtils.getExitDir(str, isHtml) == Dir.LTR)) {
        return BidiUtils.Format.RLM_STRING;
      }
      return "";
    }
docs: Returns a Unicode bidi mark matching the context directionality (LRM or RLM) if either the
  overall or the exit directionality of a given string is opposite to the context directionality.
  Putting this after the string (including its directionality declaration wrapping) prevents it
  from "sticking" to other opposite-directionality text or a number appearing after it inline
  with only neutral content in between. Otherwise returns the empty string. While the exit
  directionality is determined by scanning the end of the string, the overall directionality is
  given explicitly in {@code dir}.
  
  @param str String after which the mark may need to appear
  @param dir {@code str}'s overall directionality. If null, i.e. unknown, it is estimated.
  @param isHtml Whether {@code str} is HTML / HTML-escaped
  @return LRM for RTL text in LTR context; RLM for LTR text in RTL context; else, the empty
  string.