code: public static boolean requiresBidi(char[] text,
              int start,
              int limit)
      {
          final int RTLMask = (1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT |
                  1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC |
                  1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING |
                  1 << UCharacter.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE |
                  1 << UCharacter.DIRECTIONALITY_ARABIC_NUMBER);
  
          for (int i = start; i < limit; ++i) {
              if (((1 << UCharacter.getDirection(text[i])) & RTLMask) != 0) {
                  return true;
              }
          }
          return false;
      }
docs: Return true if the specified text requires bidi analysis. If this returns
  false, the text will display left-to-right. Clients can then avoid
  constructing a Bidi object. Text in the Arabic Presentation Forms area of
  Unicode is presumed to already be shaped and ordered for display, and so
  will not cause this method to return true.
  
  @param text the text containing the characters to test
  @param start the start of the range of characters to test
  @param limit the limit of the range of characters to test
  
  @return true if the range of characters requires bidi analysis