void setPara(CharSequence text, int start, int end, TextDirectionHeuristic textDir) {
   this.mText = text;
   this.mTextStart = start;
   int len = end - start;
   this.mLen = len;
   this.mPos = 0;
   if (this.mWidths == null || this.mWidths.length < len) {
     this.mWidths = ArrayUtils.newUnpaddedFloatArray(len);
   }
   if (this.mChars == null || this.mChars.length < len) {
     this.mChars = ArrayUtils.newUnpaddedCharArray(len);
   }
   TextUtils.getChars(text, start, end, this.mChars, 0);
   if (text instanceof Spanned) {
     Spanned spanned = (Spanned) text;
     ReplacementSpan[] spans =
         (ReplacementSpan[]) spanned.getSpans(start, end, ReplacementSpan.class);
     for (int i = 0; i < spans.length; i++) {
       int startInPara = spanned.getSpanStart(spans[i]) - start;
       int endInPara = spanned.getSpanEnd(spans[i]) - start;
       if (startInPara < 0) {
         startInPara = 0;
       }
       if (endInPara > len) {
         endInPara = len;
       }
       for (int j = startInPara; j < endInPara; j++) {
         this.mChars[j] = '\ufffc';
       }
     }
   }
   if ((textDir == TextDirectionHeuristics.LTR
           || textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR
           || textDir == TextDirectionHeuristics.ANYRTL_LTR)
       && TextUtils.doesNotNeedBidi(this.mChars, 0, len)) {
     this.mDir = 1;
     this.mEasy = true;
     return;
   }
   int bidiRequest;
   if (this.mLevels == null || this.mLevels.length < len) {
     this.mLevels = ArrayUtils.newUnpaddedByteArray(len);
   }
   if (textDir == TextDirectionHeuristics.LTR) {
     bidiRequest = 1;
   } else if (textDir == TextDirectionHeuristics.RTL) {
     bidiRequest = -1;
   } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_LTR) {
     bidiRequest = 2;
   } else if (textDir == TextDirectionHeuristics.FIRSTSTRONG_RTL) {
     bidiRequest = -2;
   } else {
     bidiRequest = textDir.isRtl(this.mChars, 0, len) ? -1 : 1;
   }
   this.mDir = AndroidBidi.bidi(bidiRequest, this.mChars, this.mLevels, len, false);
   this.mEasy = false;
 }