publicclassSolution { /** * @param str: str: the given string * @return: char: the first unique character in a given string */publiccharfirstUniqChar(String str) {if (str ==null||str.length() ==0)return'0';int[] map =newint[256];for (int i =0; i <str.length(); i++) { map[str.charAt(i)]++; }for (int i =0; i <str.length(); i++) {if (map[str.charAt(i)] ==1)returnstr.charAt(i); }return'0'; }}