Capitalizing the first character of a string - Java
<p>I've looked all over for how to capitalize the first character of a string, but nothing I've found has helped.  For my method to work, I need to set a user entered string to lower case.</p>

<pre><code>sourceText = enterText.getText();
char chr = sourceText.charAt(0);
</code></pre>

<p>so I have a boolean that's true if the first character is uppercase.</p>

<pre><code>boolean upperCase = Character.isUpperCase(chr);
sourceTextLower = sourceText.toLowerCase();
</code></pre>

<p>Cool stuff happens here, and the final product is another string called translatedTextString and an if statement</p>

<pre><code>String s2 = "";
if(upperCase == true)
{
    int x = translatedTextString.length();
    s2 = translatedTextString.substring(0,1).toUpperCase().concat(translatedTextString.substring(1, x));
}

//translatedText is a label
translatedText.setText(s2);
</code></pre>

<p>However, when I run the program, the first character of my result is still lower case.  So my questions is: is this even the right way to go about doing this? If so, what am I doing wrong, and if not, how can I do it correctly?</p>
