code: public static boolean startsWith(
              final boolean caseSensitive,
              final char[] text, final int textOffset, final int textLen,
              final CharSequence prefix, final int prefixOffset, final int prefixLen) {
  
          if (text == null) {
              throw new IllegalArgumentException("Text cannot be null");
          }
          if (prefix == null) {
              throw new IllegalArgumentException("Prefix cannot be null");
          }
  
          if (textLen < prefixLen) {
              return false;
          }
  
          char c1, c2;
  
          int n = prefixLen;
          int i = 0;
  
          while (n-- != 0) {
  
              c1 = text[textOffset + i];
              c2 = prefix.charAt(prefixOffset + i);
  
              if (c1 != c2) {
  
                  if (caseSensitive) {
                      return false;
                  }
  
                  c1 = Character.toUpperCase(c1);
                  c2 = Character.toUpperCase(c2);
  
                  if (c1 != c2) {
  
                      // We check both upper and lower case because that is how String#equalsIgnoreCase() is defined.
                      // See String#regionMatches(boolean,int,String,int,int)
                      if (Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
                          return false;
                      }
  
                  }
  
              }
  
              i++;
  
          }
  
          return true;
  
      }
docs: <p>
  Checks whether a text starts with a specified prefix, specifying (offset,len) pairs
  for limiting the fragments to be checked.
  </p>
  
  @param caseSensitive whether the comparison must be done in a case-sensitive or case-insensitive way.
  @param text the text to be checked for prefixes.
  @param textOffset the offset of the text.
  @param textLen the length of the text.
  @param prefix the prefix to be searched.
  @param prefixOffset the offset of the prefix.
  @param prefixLen the length of the prefix.
  @return whether the text starts with the prefix or not.