public class Anagram { int isAnagramOfPalindrome ( String S ) { char [] tab = S.toCharArray(); HashMap map = new HashMap(); for(int i = 0; i < tab.length ; i++){ Character tmp = tab[i]; if(map.containsKey(tmp)){ Integer j = map.get(tmp); Integer jj = j+1; map.put(tmp, jj); } else{ map.put(tmp, 0); } } int a = 0; Collection col = map.values(); Integer [] val = (Integer[]) col.toArray(); for(int i = 0 ; i < val.length ; i++){ int iii = val[i].intValue(); if((val[i].intValue()%2) == 0){ } else{ a++; } } if(a==1){ return 1; } else{ return 0; } } }