store each string in sentence in reverse way <p>i try with buffered string.reverse(); but i want reverse each word of sentence. so i try with this..</p> <pre><code> for(int a = 0;a &lt;= msgLength; a++){ temp += msg.charAt(a); if((msg.charAt(a) == '')||(a == msgLength)){ for(int b = temp.length()-1; b &gt;= 0; b--){ encrypt_msg += temp.charAt(a); if((b == 0) &amp;&amp; (a != msgLength)) encrypt_msg += ""; } temp = ""; } } </code></pre> <p>plz help me to simplify this logic. string is user defined. i wanted to print reversed string in jtextfields. </p>