protected void ensureCapacity(int min){
  if (buf.length < min) {
    int size=buf.length * 2;
    int max=Math.max(min,size);
    char[] temp=new char[max];
    System.arraycopy(buf,0,temp,0,count);
    buf=temp;
  }
}

protected void ensureCapacity ( int min ) { if ( buf . length < min ) { int size = buf . length * 2 ; int max = Math . max ( min , size ) ; char [ ] temp = new char [ max ] ; System . arraycopy ( buf , 0 , temp , 0 , count ) ; buf = temp ; } }
this ensure that there is enough space in the buffer to allow for more characters to be added . if the buffer is already larger than min then the buffer will not be expanded at all .
