You are viewing a single comment's thread. Return to all comments →
There are many ways to do it. None of them result in pretty code. One way is to use a StringBuffer and save the output into the StringBuffer instead of printing the output immediatelly. Once the StringBuilder has the entire output, you can delete the last space and print the StringBuffer.