Storing StringBuffer
<p>I have a StringBuffer in my Class which deletes certain characters if the conditions are met in the IF statement and prints the statement. However, this could be repeated many times. If the second condition is met, the first statement will print out WITHOUT the characters being deleted.</p>

<p>Is there a way around this? Below is my code.</p>

<pre><code>    if (status == 1 &amp;&amp; item == item1[1]){
        item1[1] = "*"; 
        w = sb1.append(item1[1]+"["+item2[1]+"] ");
        sb1.delete(1,4);
    }else if (status == 1 &amp;&amp; item == item1[2]){
        item1[2] = "*";
        x = sb1.append(item1[2]+"["+item2[2]+"] ");
        sb1.delete(1,4);
    }else if(status == 1 &amp;&amp; item == item1[3]){
        item1[3] = "*";
        y = sb1.append(item1[3]+"["+item2[3]+"] ");
        sb1.delete(1,4);   
    }  
    return w.toString()+x.toString()+y.toString()+z.toString();
</code></pre>

<hr>

<p>What i'm trying to achieve is the following:
I have a toString which is made up of:</p>

<p>item1[1]+"["item2[1]"] "+item1[2]+" ["+tem2[2]+"]"</p>

<p>I want to do this:</p>

<p>if item1 is marked as taken, it will be changed to "*" and remove the item2[1] and the  [ ] around it and then return it as: </p>

<pre><code>     eg: item1[2] = x 
         item2[2] = 1


    * x[1]

( * used to be item1[1] )
</code></pre>

<p>but if the loops passes through again, my current class does this:
         *[] *[1]
i want it to be:
 * *
When the loop is complete</p>
