So you have a URL of this scheme after you decoded it (e.g. with java.net.URLDecoder.decode()):
http://www.google.com/here/is/some/content
To get the Domain and the Protocol from the input, you can use a regex like this:
String input = URLDecoder.decode("http%3a%2f%2fwww.google.com%2fpagead%2fconversion%2f1001680686%2f%3flabel%3d4dahCKKczAYQrt7R3QM%26value%3d%26muid%3d_0RQqV8nf-ENh3b4qRJuXQ%26bundleid%3dcom.google.android.youtube%26appversion%3d5.10");
Matcher m = Pattern.compile("(http[s]?)://([^/]+)(/.*)?").matcher(input);
if (!m.matches()) return;
String protocol = m.group(1);
String domain = m.group(2);
System.out.println(protocol + "://" + domain);
Explanation of the regex:
(http[s]?)://([^/]+)(/.*)?
|---1----|-2-|--3--|--4---|
- Matches the protocols
http and https
- Matches the :// behind the protocol
- Matches the domain name (
[^/]+ is any string that doesn't contain a slash)
- Matches everything behind the domain (must start with a slash)