Java tutorial
//package com.java2s; import java.net.URLEncoder; public class Main { private final static String formatURL(String path) { if (path.startsWith("http://") || path.startsWith("https://")) return path; return "http://" + URLEncoder.encode(path); } }