text: public void setLength(int length) {if (length < 0) {throw new StringIndexOutOfBoundsException("length < 0: " + length);}if (length > value.length) {enlargeBuffer(length);} else {if (shared) {char[] newData = new char[value.length];System.arraycopy(value, 0, newData, 0, count);value = newData;shared = false;} else {if (count < length) {Arrays.fill(value, count, length, (char) 0);}}}count = length;}