private static String arrayToString(int[] array){
  StringBuilder sb=new StringBuilder();
  boolean first=true;
  for (  int i : array) {
    if (first) {
      first=false;
    }
 else {
      sb.append(" ");
    }
    sb.append(i);
  }
  return sb.toString();
}

private static String arrayToString ( int [ ] array ) { StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( int i : array ) { if ( first ) { first = false ; } else { sb . append ( " " ) ; } sb . append ( i ) ; } return sb . toString ( ) ; }
converts an array into a string
