title: Java: join array of primitives with separator
body: <p>Suppose, I have an array:</p>
  
  <pre><code>int[] arr = new int[] {1, 2, 3, 4, 5, 6, 7};
  </code></pre>
  
  <p>And I need to join its elements using separator, for example, <code>" - "</code>, so as the result I should get string like this:</p>
  
  <pre><code>"1 - 2 - 3 - 4 - 5 - 6 - 7"
  </code></pre>
  
  <p>How could I do this?</p>
  
  <p><strong>PS:</strong> yes, I know about <a href="https://stackoverflow.com/questions/1978933/a-quick-and-easy-way-to-join-array-elements-with-a-separator-the-opposite-of-sp">this</a> and <a href="https://stackoverflow.com/questions/1515437/java-function-for-arrays-like-phps-join">this</a> posts, but its solutions won't work with an array of primitives.</p>