I want to remove new line character and carriage return from the end of the String. Do we have the functionality of rtrim in java?