private static void replaceChar(Document document, int offset, char newChar) {
    document.replaceString(offset, offset + 1, String.valueOf(newChar));
  }
private static void replaceChar(Document document, int offset, char newChar)