title: Appending with StringBuilder
body: <p>I have 5 checkboxes and I have to select multiple checkboxes.</p>
  
  <p>I made a code like this to check check box is checked:</p>
  
  <pre><code>sports=(CheckBox)findViewById(R.id.sports_btn);
  sports.setOnClickListener(new OnClickListener() {
  
      @Override
      public void onClick(View v) {
          if (sports.isChecked() == true)
          list.add("4");
      }
  }); 
  </code></pre>
  
  <p>I am adding a value to an array list:</p>
  
  <pre><code>list ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
  </code></pre>
  
  <p>and I am retrieving the value as string like this:</p>
  
  <pre><code>StringBuilder sb = new StringBuilder();
  for(int  i =0; i &lt; list.size(); i++)
  {
      for (String str: list)
      {  
          sb.append(str.toString());
          sb.append(",");
      }
  
  }
  String sel_cat = sb;
  </code></pre>
  
  <p>I am getting the string but if two values are selected it is coming like 2,3,
  How to remove that last comma? I don't want the last comma the string has to be like 2,3.</p>