code: public static Map<String,String> getQueryParams(String s) throws MalformedURLException {
          Map<String,String> params = new HashMap<String, String>();
  
          for (String kv : s.split("&")) {
              String[] parts = kv.split("=");
              if (parts.length != 2) {
                  throw new MalformedURLException();
              }
              try {
                  String k = URLDecoder.decode(parts[0], "UTF-8");
                  String v = URLDecoder.decode(parts[1], "UTF-8");
                  params.put(k, v);
              } catch (UnsupportedEncodingException ex) {
                  throw new MalformedURLException(ex.getMessage());
              }
          }
          return params;
      }
docs: Get traditional query parameters as a Java map
  @param s The query string
  @return A Java map with key-value pairs derived from the query string
  @throws MalformedURLException If the query string is malformed.