java string remove substring from end