public String canonicalizedQueryString(Map<String, String> queryParameters) {
        List<Map.Entry<String, String>> sortedList = getSortedMapEntries(queryParameters);

        StringBuilder queryString = new StringBuilder();
        for (Map.Entry<String, String> entry : sortedList) {
            queryString.append(entryToQuery(entry));
        }

        if (queryString.length() > START_INDEX) {
            queryString.deleteCharAt(queryString.length() - ONE);   //removing last '&'
        }

        return queryString.toString();
    }
public String canonicalizedQueryString ( Map < String , String > queryParameters ) { List < Map . Entry < String , String > > sortedList = getSortedMapEntries ( queryParameters ) ; StringBuilder queryString = new StringBuilder ( ) ; for ( Map . Entry < String , String > entry : sortedList ) { queryString . append ( entryToQuery ( entry ) ) ; } if ( queryString . length ( ) > START_INDEX ) { queryString . deleteCharAt ( queryString . length ( ) - ONE ) ; } return queryString . toString ( ) ; }
Canonicalized (standardized) query string is formed by first sorting all the query
parameters, then URI encoding both the key and value and then
joining them, in order, separating key value pairs with an '&'.

@param queryParameters Query parameters to be canonicalized.
@return A canonicalized form for the specified query parameters.