public String(java.lang.StringBuffer buffer){
  this.offset=0;
  this.count=buffer.length();
  this.value=new char[count];
  buffer.getChars(0,count,value,0);
}

public String ( java . lang . StringBuffer buffer ) { this . offset = 0 ; this . count = buffer . length ( ) ; this . value = new char [ count ] ; buffer . getChars ( 0 , count , value , 0 ) ; }
allocates a new string that contains the sequence of characters currently contained in the string buffer argument . the contents of the string buffer are copied ; subsequent modification of the string buffer does not affect the newly created string . buffer - a stringbuffer . - if buffer is null .
