import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.io.UnsupportedEncodingException;
public class MyClass {
public static void main(String args[]) throws UnsupportedEncodingException {
String url = "https://www.shortinfos.com";
String encodeUrl = URLEncoder.encode(url, StandardCharsets.UTF_8.toString());
System.out.println(encodeUrl);
String decodedUrl = URLDecoder.decode(encodeUrl, "UTF-8");
System.out.println(decodedUrl);
}
}
/*
run:
https%3A%2F%2Fwww.shortinfos.com
https://www.shortinfos.com
*/