Java tutorial
//package com.java2s; public class Main { /** * @param genotype * @param treatment * @return */ private static String getGenotypeAndTreatment(String genotype, String treatment) { StringBuilder res = new StringBuilder(); if (genotype != null && genotype.length() > 0) res.append(genotype); if (treatment != null && treatment.length() > 0) { if (res.length() > 0) res.append("/"); res.append(treatment); } if (res.length() > 0) return " (" + res.toString() + ")"; else return ""; } }