[java] How to remove first and last character of a string?