public static String toString(Iterator<?> iter,String separator){
  StringBuilder sb=new StringBuilder();
  toString(iter,separator,sb);
  return sb.toString();
}

public static String toString ( Iterator < ? > iter , String separator ) { StringBuilder sb = new StringBuilder ( ) ; toString ( iter , separator , sb ) ; return sb . toString ( ) ; }
converts an iterator to a string by concatenating all of the string representations of objects in the iterator , divided by a separator .
