System.arraycopy(styles, modifyStart + 1, styles, modifyStart + 2, styleCount - modifyStart + 1);
System.arraycopy(styles, modifyStart + 1, styles, modifyStart + 2, styleCount - (modifyStart + 1));
void updateRanges(int start, int replaceCharCount, int newCharCount) {	if (styleCount == 0 || (replaceCharCount == 0 && newCharCount == 0)) return;	if (ranges != null) {		int rangeCount = styleCount << 1;		int modifyStart = getRangeIndex(start, -1, rangeCount);		if (modifyStart == rangeCount) return;		int end = start + replaceCharCount;		int modifyEnd = getRangeIndex(end, modifyStart - 1, rangeCount);		int offset = newCharCount - replaceCharCount;		if (modifyStart == modifyEnd && ranges[modifyStart] < start && end < ranges[modifyEnd] + ranges[modifyEnd + 1]) {			if (newCharCount == 0) {				ranges[modifyStart + 1] -= replaceCharCount;				modifyEnd += 2;			} else {				if (rangeCount + 2 > ranges.length) {					int[] newRanges = new int[ranges.length + (GROW << 1)];					System.arraycopy(ranges, 0, newRanges, 0, rangeCount);					ranges = newRanges;					StyleRange[] newStyles = new StyleRange[styles.length + GROW];					System.arraycopy(styles, 0, newStyles, 0, styleCount);					styles = newStyles;				}				System.arraycopy(ranges, modifyStart + 2, ranges, modifyStart + 4, rangeCount - modifyStart + 2);				System.arraycopy(styles, (modifyStart + 2) >> 1, styles, (modifyStart + 4) >> 1, styleCount - ((modifyStart + 2) >> 1));				ranges[modifyStart + 3] = ranges[modifyStart] + ranges[modifyStart + 1] - end;				ranges[modifyStart + 2] = start + newCharCount;				ranges[modifyStart + 1] = start - ranges[modifyStart];				styles[(modifyStart >> 1) + 1] = styles[modifyStart >> 1]; 				rangeCount += 2;				styleCount++;				modifyEnd += 4;			}			if (offset != 0) {				for (int i = modifyEnd; i < rangeCount; i += 2) {					ranges[i] += offset;				}			}		} else {			if (ranges[modifyStart] < start && start < ranges[modifyStart] + ranges[modifyStart + 1]) {				ranges[modifyStart + 1] = start - ranges[modifyStart];				modifyStart += 2;			}			if (modifyEnd < rangeCount && ranges[modifyEnd] < end && end < ranges[modifyEnd] + ranges[modifyEnd + 1]) {				ranges[modifyEnd + 1] = ranges[modifyEnd] + ranges[modifyEnd + 1] - end;				ranges[modifyEnd] = end;			}			if (offset != 0) {				for (int i = modifyEnd; i < rangeCount; i += 2) {					ranges[i] += offset;				}			}			System.arraycopy(ranges, modifyEnd, ranges, modifyStart, rangeCount - modifyEnd);			System.arraycopy(styles, modifyEnd >> 1, styles, modifyStart >> 1, styleCount - (modifyEnd >> 1));			styleCount -= (modifyEnd - modifyStart) >> 1;		}	} else {		int modifyStart = getRangeIndex(start, -1, styleCount);		if (modifyStart == styleCount) return;		int end = start + replaceCharCount;		int modifyEnd = getRangeIndex(end, modifyStart - 1, styleCount);		int offset = newCharCount - replaceCharCount;		if (modifyStart == modifyEnd && styles[modifyStart].start < start && end < styles[modifyEnd].start + styles[modifyEnd].length) {			if (newCharCount == 0) {				styles[modifyStart].length -= replaceCharCount;				modifyEnd++;			} else {				if (styleCount + 1 > styles.length) {					StyleRange[] newStyles = new StyleRange[styles.length + GROW];					System.arraycopy(styles, 0, newStyles, 0, styleCount);					styles = newStyles;				}				System.arraycopy(styles, modifyStart + 1, styles, modifyStart + 2, styleCount - modifyStart + 1);				styles[modifyStart + 1] = (StyleRange)styles[modifyStart].clone();				styles[modifyStart + 1].length = styles[modifyStart].start + styles[modifyStart].length - end;				styles[modifyStart + 1].start = start + newCharCount;				styles[modifyStart].length = start - styles[modifyStart].start;				styleCount++;				modifyEnd += 2;			}			if (offset != 0) {				for (int i = modifyEnd; i < styleCount; i++) {					styles[i].start += offset;				}			}		} else {			if (styles[modifyStart].start < start && start < styles[modifyStart].start + styles[modifyStart].length) {				styles[modifyStart].length = start - styles[modifyStart].start;				modifyStart++;			}			if (modifyEnd < styleCount && styles[modifyEnd].start < end && end < styles[modifyEnd].start + styles[modifyEnd].length) {				styles[modifyEnd].length = styles[modifyEnd].start + styles[modifyEnd].length - end;				styles[modifyEnd].start = end;			}			if (offset != 0) {				for (int i = modifyEnd; i < styleCount; i++) {					styles[i].start += offset;				}			}			System.arraycopy(styles, modifyEnd, styles, modifyStart, styleCount - modifyEnd);			styleCount -= modifyEnd - modifyStart;		}	}}