title: Produce a comma separated list using StringBuilder
body: <p>Following is my scenario, though I have achieved the desired output but I want it to be a decent and optimized code.</p>
  
  <pre><code>String arr[]={"we","er","rtt","yu","uu","ii"};
  
        StringBuilder strcat = new StringBuilder();
  
        for(int i1=0;i1&lt;arr.length;i1++)
        {
            // Some processing
           strcat.append(arr[i1]);
  
           if(arr.length-1!=i1)
           {
  
                strcat.append(",");
           }
        }
  
       System.out.println("Value:"+strcat);
  </code></pre>
  
  <p>I have <code>String[]</code> array and some processing, after processing I want to append the values with comma(<code>,</code>).
  the problem is  comma , it appends to last values also, that I don’t want, I have applied a logic. I don’t know whether it is correct.but output is correct.Please do correct me if I am wrong and do suggest if it has any other means to achieve.</p>