public static int binarySearch(
            final boolean caseSensitive, final CharSequence[] values,
            final char[] text, final int textOffset, final int textLen) {

        if (values == null) {
            throw new IllegalArgumentException("Values array cannot be null");
        }
        return binarySearch(caseSensitive, values, 0, values.length, text, textOffset, textLen);

    }
public static int binarySearch ( final boolean caseSensitive , final CharSequence [ ] values , final char [ ] text , final int textOffset , final int textLen ) { if ( values == null ) { throw new IllegalArgumentException ( "Values array cannot be null" ) ; } return binarySearch ( caseSensitive , values , 0 , values . length , text , textOffset , textLen ) ; }
<p>
Searches the specified array of texts ({@code values}) for the specified text &mdash;or a fragment, using an
(offset,len) specification&mdash; using the binary search algorithm.
</p>
<p>
Note the specified {@code values} parameter <strong>must be lexicographically ordered</strong>.
</p>

@param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way.
@param values the array of texts inside which the specified text will be searched.
Note that it must be <strong>ordered</strong>.
@param text the text to search.
@param textOffset the offset of the text to search.
@param textLen the length of the text to search.
@return index of the search key, if it is contained in the values array; otherwise,
{@code (-(insertion point) - 1)}. The insertion point is defined as the point at
which the key would be inserted into the array. Note that this guarantees that the return value will
be &gt;= 0 if and only if the key is found.