public static String joinOptions(String[] optionArray){
  String optionString="";
  for (  String element : optionArray) {
    if (element.equals("")) {
      continue;
    }
    boolean escape=false;
    for (int n=0; n < element.length(); n++) {
      if (Character.isWhitespace(element.charAt(n))) {
        escape=true;
        break;
      }
    }
    if (escape) {
      optionString+='"' + backQuoteChars(element) + '"';
    }
 else {
      optionString+=element;
    }
    optionString+=" ";
  }
  return optionString.trim();
}

public static String joinOptions ( String [ ] optionArray ) { String optionString = "" ; for ( String element : optionArray ) { if ( element . equals ( "" ) ) { continue ; } boolean escape = false ; for ( int n = 0 ; n < element . length ( ) ; n ++ ) { if ( Character . isWhitespace ( element . charAt ( n ) ) ) { escape = true ; break ; } } if ( escape ) { optionString += '"' + backQuoteChars ( element ) + '"' ; } else { optionString += element ; } optionString += " " ; } return optionString . trim ( ) ; }
joins all the options in an option array into a single string , as might be used on the command line .
