public static String joinOptions(String[] optionArray) {

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

@param optionArray the array of options
@return the string containing all options.