public char[] get(int posStart, int length) {assert length > 0;assert inBounds(posStart): "posStart=" + posStart + " length=" + length;final int startIndex = getIndex(posStart);final int endIndex = getIndex(posStart + length);final char[] result = new char[length];if (endIndex >= startIndex && length < buffer.length) {System.arraycopy(buffer, startIndex, result, 0, endIndex-startIndex);} else {final int part1 = buffer.length-startIndex;System.arraycopy(buffer, startIndex, result, 0, part1);System.arraycopy(buffer, 0, result, buffer.length-startIndex, length-part1);}return result;}

public char[] Get(int posStart, int length){Debug.Assert(length > 0);Debug.Assert(InBounds(posStart), "posStart=" + posStart + " length=" + length);int startIndex = GetIndex(posStart);int endIndex = GetIndex(posStart + length);var result = new char[length];if (endIndex >= startIndex && length < buffer.Length){Array.Copy(buffer, startIndex, result, 0, endIndex - startIndex);}else{int part1 = buffer.Length - startIndex;Array.Copy(buffer, startIndex, result, 0, part1);Array.Copy(buffer, 0, result, buffer.Length - startIndex, length - part1);}return result;}
