Java tutorial
//package com.java2s; import android.text.TextUtils; public class Main { public static String concatenateWhereAND(String a, String b) { if (TextUtils.isEmpty(a)) { return b; } if (TextUtils.isEmpty(b)) { return a; } return "(" + a + ") AND (" + b + ")"; } }