Java tutorial
//package com.java2s; public class Main { public static String getImageNetPath(String path, String domain) { if (path.startsWith("http://")) { return path; } else { if (domain.endsWith("/") && path.startsWith("/")) { return domain + path.substring(1); } else if (!domain.endsWith("/") && path.startsWith("/")) { return domain + path; } else if (domain.endsWith("/") && !path.startsWith("/")) { return domain + path; } else { return domain + "/" + path; } } } }