code: public static String getParameterValueFromQuery(String query, String paramName) {
          String[] components = query.split("&");
  
          for (String keyValuePair : components) {
              String[] pairComponents = keyValuePair.split("=");
  
              if (pairComponents.length == 2) {
                  try {
                      String key = URLDecoder.decode(pairComponents[0], "utf-8");
                      if (key.compareTo(paramName) == 0) {
                          return URLDecoder.decode(pairComponents[1], "utf-8");
                      }
                  } catch (UnsupportedEncodingException e) {
                      logger.error("getParameterValueFromQuery failed with exception: " + e.getLocalizedMessage(), e);
                  }
  
              }
          }
  
          return null;
      }
docs: Obtains a parameter with specified name from from query string. The query should be in format
  param=value&param=value ...
  
  @param query     Queery in "url" format.
  @param paramName Parameter name.
  @return Parameter value, or null.