private static int alignToCodePointBoundary(char[] text, int offset) {
    return isInsideSurrogatePair(text, offset) ? offset - 1 : offset;
  }
private static int alignToCodePointBoundary(char[] text, int offset)