Java tutorial
//package com.java2s; public class Main { private static String buildURI(String host, String location, boolean isSecure) { StringBuffer uri = new StringBuffer(); if (isSecure) uri.append("https://"); else uri.append("http://"); uri.append(host); uri.append(location); return uri.toString(); } }