public static CharacterBuffer newCharacterBuffer(final int bufferSize) {
    if (bufferSize < 2) {
      throw new IllegalArgumentException("buffersize must be >= 2");
    }
    return new CharacterBuffer(new char[bufferSize], 0, 0);
  }
Creates a new {@link CharacterBuffer} and allocates a <code>char[]</code>
of the given bufferSize.

@param bufferSize
         the internal char buffer size, must be <code>&gt;= 2</code>
@return a new {@link CharacterBuffer} instance.
linguistics/src/main/java/com/yahoo/language/simple/kstem/CharacterUtils.java