java string replace last occurrence of character