int[] (CaretModel caretModel) { int[] caretOffsets = new int[caretModel.getCaretCount()]; int i = 0; for (Caret caret : caretModel.getAllCarets()) { caretOffsets[i++] = caret.getOffset(); } return caretOffsets; }