Finding characters in a string
<p>i'm doing an encoding program where i'm supposed to delete every character in the string which appears twice. i've tried to traverse through the string but it hasn't worked. does anyone know how to do this? Thanks.</p>

<pre><code>public static String encodeScrambledAlphabet(String str)
{
    String newword = str;
    String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    newword += alphabet;

    newword = newword.toUpperCase();

    for (int i = 0, j = newword.length(); i &lt; newword.length() &amp;&amp; j &gt;=0; i++,j--)
    {
        char one = newword.charAt(i);
        char two = newword.charAt(j);

        if (one == two)
        {
            newword = newword.replace(one, ' ');
        }



    }

    newword = newword.replaceAll(" ", "");

    return newword;
}
</code></pre>
