Java tutorial
//package com.java2s; public class Main { public static String addCondition(String conditions, String key, String value) { if ((conditions == null) || (key == null) || (value == null) || (key == "") || (value == "")) return conditions; conditions = (new StringBuilder(String.valueOf(conditions))).append(" and ").append(key).append(" = '") .append(value).append("'").toString(); return conditions; } public static String addCondition(String conditions, String condition) { if ((conditions == null) || (condition == null) || "".equals(condition)) return conditions; conditions = (new StringBuilder(String.valueOf(conditions))).append(" and ").append(condition).toString(); return conditions; } }