private static boolean containsSurrogatePairs(char[] chars, int start, int end) {
    end--; // no need to check last character for high surrogate
    for (int i = start; i < end; i++) {
      if (Character.isHighSurrogate(chars[i]) && Character.isLowSurrogate(chars[i + 1])) {
        return true;
      }
    }
    return false;
  }
private static boolean containsSurrogatePairs(char[] chars, int start, int end)