as a matter of an excersice i would advise you to keep your parameters as List<String>...
public static void main(String[] args) {
boolean printNewline = true;
List<String> parameters = new ArrayList<>(Arrays.asList(args);
if (args.length > 0 && isNewLine(args[0]) ) {
printNewline = false;
parameters.remove(0); //remove the first one
}
String output = parameters.stream()
.collect(Collectors.joining(" ", "", printNewLine ? "\n"System.lineSeparator() : ",")"")
System.out.printlnprint(output);
}
NOTE: the method isNewLine() is not shown here - but you should consider using such a method to prevent a missing argument... think of -n, -N, /n, /N, all these parameters can be handle in the isNewLine-method...