public static boolean requiresBidi(char[] text,int start,int limit){
  final int RTLMask=(1 << Bidi.DIRECTION_RIGHT_TO_LEFT | 1 << AL | 1 << RLE | 1 << RLO | 1 << AN);
  if (0 > start || start > limit || limit > text.length) {
    throw new IllegalArgumentException("Value start " + start + " is out of range 0 to "+ limit);
  }
  for (int i=start; i < limit; ++i) {
    if (Character.isHighSurrogate(text[i]) && i < (limit - 1) && Character.isLowSurrogate(text[i + 1])) {
      if (((1 << UCharacter.getDirection(Character.codePointAt(text,i))) & RTLMask) != 0) {
        return true;
      }
    }
 else     if (((1 << UCharacter.getDirection(text[i])) & RTLMask) != 0) {
      return true;
    }
  }
  return false;
}

public static boolean requiresBidi ( char [ ] text , int start , int limit ) { final int RTLMask = ( 1 << Bidi . DIRECTION_RIGHT_TO_LEFT | 1 << AL | 1 << RLE | 1 << RLO | 1 << AN ) ; if ( 0 > start || start > limit || limit > text . length ) { throw new IllegalArgumentException ( "Value start " + start + " is out of range 0 to " + limit ) ; } for ( int i = start ; i < limit ; ++ i ) { if ( Character . isHighSurrogate ( text [ i ] ) && i < ( limit - 1 ) && Character . isLowSurrogate ( text [ i + 1 ] ) ) { if ( ( ( 1 << UCharacter . getDirection ( Character . codePointAt ( text , i ) ) ) & RTLMask ) != 0 ) { return true ; } } else if ( ( ( 1 << UCharacter . getDirection ( text [ i ] ) ) & RTLMask ) != 0 ) { return true ; } } return false ; }
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 .
