title: Java - convert array to sentence
body: <p>I have following method:</p>
  
  <pre><code>public static void sentence(String sen)
  {
  
      String[] array = sen.split(" ");
      String[] five = Arrays.copyOfRange(Array, 0, 5);
  
      if (Array.length &lt; 6)
          System.out.println(sen);
      else
          System.out.print(Arrays.toString(five));
  }
  </code></pre>
  
  <p>As an argument I enter a sentence. If the sentence is longer than 5 words I only want the first 5 words to be printed out. What happens is that the printout when sen > 5 looks something like:</p>
  
  <p>[word1, word2, word3, word4, word5]</p>
  
  <p>What I want it to look like is:</p>
  
  <p>word1 word2 word3 word4 word5</p>
  
  <p>Any suggestion on how to convert the array to a normal sentence format as in the latter example?</p>