title: How to remove only trailing spaces of a string in Java and keep leading spaces?
body: <p>The <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#trim()" rel="noreferrer"><code>trim()</code></a> function removes both the trailing and leading space, however, if I only want to remove the trailing space of a string, how can I do it?</p>