void replace(int offset,int length,char[] replArray,int replOffset,int replLength){
  int delta=replLength - length;
  int src=offset + length;
  int nmove=count - src;
  int dest=src + delta;
  if ((count + delta) >= data.length) {
    int newLength=Math.max(2 * data.length,count + delta);
    char[] newData=new char[newLength];
    System.arraycopy(data,0,newData,0,offset);
    System.arraycopy(replArray,replOffset,newData,offset,replLength);
    System.arraycopy(data,src,newData,dest,nmove);
    data=newData;
  }
 else {
    System.arraycopy(data,src,data,dest,nmove);
    System.arraycopy(replArray,replOffset,data,offset,replLength);
  }
  count=count + delta;
}

void replace ( int offset , int length , char [ ] replArray , int replOffset , int replLength ) { int delta = replLength - length ; int src = offset + length ; int nmove = count - src ; int dest = src + delta ; if ( ( count + delta ) >= data . length ) { int newLength = Math . max ( 2 * data . length , count + delta ) ; char [ ] newData = new char [ newLength ] ; System . arraycopy ( data , 0 , newData , 0 , offset ) ; System . arraycopy ( replArray , replOffset , newData , offset , replLength ) ; System . arraycopy ( data , src , newData , dest , nmove ) ; data = newData ; } else { System . arraycopy ( data , src , data , dest , nmove ) ; System . arraycopy ( replArray , replOffset , data , offset , replLength ) ; } count = count + delta ; }
replaces some of the characters in the array
