title: Add space as split to strings using Java 8 stream (lambdas)
body: <p>I'm writing a Xor method which ecnrypts some string by adding (as xor operation) random values to its characters. Result should look like as string with hex values of encrypted characters.</p>
  
  <p><strong>Example:</strong></p>
  
  <p>"<em>Hello world</em>" => "<em>0006F 00046 00066 00076 0004D 0007F 00047 0007D 00062 0006E</em>"</p>
  
  <p><strong>The code:</strong></p>
  
  <pre><code>StringBuilder sb = new StringBuilder();
  
  inputText.chars()                                      // get char stream
           .filter(c -&gt; c != ' ')                         // remove spaces
           .map(c -&gt; c ^ random.nextInt(randBound))       // do xor for each char
           .boxed()                                       // to Integer stream
           .map(i -&gt; String.format("%05X ", i &amp; 0xFFFFF)) // to Hex String values
           .forEach(sb::append);
  
  if (sb.length() &gt; 0)
      sb.deleteCharAt(sb.length() - 1);
  
  return sb.toString();
  </code></pre>
  
  <p>As you see, I've formated the result as <code>"%05X "</code>, so I've got unwanted space in the end of string. And need to use <code>sb.deleteCharAt(sb.length() - 1);</code>.</p>
  
  <p>How to format the correct result directly in stream?</p>