ArrayList<String> list = new ArrayList<String>(); list.add(String.valueOf(chs.toCharArray()[chs.length()-1])); if(chs.length() <= 1){ return list; } int length = chs.length(); for(int i=0; i<length-1; i++){ int count = list.size(); for(int j=0; j<count; j++){ StringBuffer sb = new StringBuffer(); sb.append(chs.toCharArray()[i]); sb.append(list.get(j)); list.add(sb.toString()); } list.add(String.valueOf(chs.toCharArray()[i])); } return list;