Returning a toString from a StringBuffer
<p>This is my class:</p>

<pre><code>    public String toString(){
    status = status1.getStat();
    item = status1.getItem();
    boolean checked;
    checked = false;
    StringBuffer sb1 = new StringBuffer("");
    StringBuffer s1, s2, s3, z;
    s1 = new StringBuffer(item1[1]+"["+item2[1]+"] ");
    s2 = new StringBuffer(item1[2]+"["+item2[2]+"] ");
    s3 = new StringBuffer(item1[3]+"["+item2[3]+"] ");
    z = new StringBuffer(" player("+player+") - "+points+" points ");
    //sb1.append(item1[1]+"["+item2[1]+"] "+item1[2]+"["+item2[2]+"] "+ item1[3]+"["+item2[3]+"] "+ "player("+player+") - "+points+" points ");

    if (status == 1 &amp;&amp; item.equals(item1[1])){
        item1[1] = "*"; 
        s1 = sb1.append(item1[1]+" ");
        //sb1.delete(1,4);
    }else if (status == 1 &amp;&amp; item.equals(item1[2])){
        item1[2] = "*";
        s2 = sb1.append(item1[2]+" ");

    }else if(status == 1 &amp;&amp; item.equals(item1[3])){
        item1[3] = "*";
        s3 = sb1.append(item1[3]+" ");

    }  

    return s1.toString()+s2.toString()+s3.toString()+z.toString();
</code></pre>

<p>My output is the following:</p>

<pre><code>Let: 
 item1[1] = Alpha
 item2[1] = 1
 item3[1] = 0
 -----
 item1[2] = Beta
 item2[2] = 1
 item2[2] = 0
 -----
 item1[3] = Charlie
 item2[3] = 2
</code></pre>

<p>My output is:</p>

<pre><code>when status = 1 and item = item1[1]
--
* Beta[1] Charlie[2]
--
When run the code for the second time
*[1] * Charlie[2]
--
When i run the code for the third time
*[1] *[1] Charlie[2]
</code></pre>

<p>Is it possible to make it like the following?</p>

<pre><code>when status = 1 and item = item1[1]
--
* Beta[1] Charlie[2]
--
When run the code for the second time
*  * Charlie[2]
--
When i run the code for the third time
* * *
</code></pre>

<p>This will need to happen in random order.</p>
