docs: public static void replaceAll(StringBuffer haystack, String needle, String newNeedle, int interval) {
  		if (needle == null) {
  			throw new IllegalArgumentException("string to replace can not be empty");
  		}
  		int idx = haystack.indexOf(needle);
  		int nextIdx = -1;
  		int processedChunkSize = idx;
  		int needleLength = needle.length();
  		int newNeedleLength = newNeedle.length();
  		while (idx != -1/* && idx < haystack.length()*/) {
  			if (processedChunkSize >= interval) {
  				haystack.replace(idx, idx + needleLength, newNeedle);
  				nextIdx = haystack.indexOf(needle, idx + newNeedleLength);
  				processedChunkSize = nextIdx - idx;//length of replacement is not included
  				idx = nextIdx;
  			}
  			else {
  				nextIdx = haystack.indexOf(needle, idx + newNeedleLength);
  				processedChunkSize += nextIdx - idx;
  				idx = nextIdx;
  				if (newNeedleLength == 0) {
  					return;
  				}
  			}
  		}
  	}