code: public void shrink() {
          if (c.length == length) {
              return;
          }
          char[] newc = new char[length];
          System.arraycopy(c, 0, newc, 0, length);
          c = newc;
      }
docs: Shrinks the capacity of the buffer to the current length if necessary.
  This method involves copying the data once!