public static Map<String, String> parseQueryString(String queryStr)
            throws UnsupportedEncodingException {

        // Split the query string into the pairs
        List<String> paramList = Arrays.asList(queryStr.split("&"));
        Map<String, String> parameters = new HashMap<String,String>();

        // Loop through key/value pairs and put them in the Map.
        for (String param : paramList) {
            String[] paramArray = param.split("=", 2);
            parameters.put(URLDecoder.decode(paramArray[0], "UTF-8"),
                           URLDecoder.decode(paramArray[1], "UTF-8"));
        }

        return parameters;
    }
public static Map < String , String > parseQueryString ( String queryStr ) throws UnsupportedEncodingException { List < String > paramList = Arrays . asList ( queryStr . split ( "&" ) ) ; Map < String , String > parameters = new HashMap < String , String > ( ) ; for ( String param : paramList ) { String [ ] paramArray = param . split ( "=" , 2 ) ; parameters . put ( URLDecoder . decode ( paramArray [ 0 ] , "UTF-8" ) , URLDecoder . decode ( paramArray [ 1 ] , "UTF-8" ) ) ; } return parameters ; }
Parse the given string for parameter key/value pairs and return
a map with the parameters.

@param queryStr
The query string to parse for key/value pairs.

@return
A map with the key/value pairs.

@throws UnsupportedEncodingException
If Java lacks UTF-8 support.