private static String decode(final String str) {
        if (str == null) {
            return null;
        }

        for (int i = 0; i < str.length(); ++i) {
            if (str.charAt(i) == '%') {
                return decode(str, i);
            }
        }

        return str;
    }
Percent-decodes the given string, with a fast path for strings that
are not percent-encoded.

@param str the string to decode
@return the decoded string
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3URI.java