```
public class Solution {
public int firstUniqChar(String s) {
char[] arr = s.toCharArray();
if (arr.length == 1) return 0;
int min = Integer.MAX_VALUE;
int[] temp = new int[128];
for (char c:arr) {
temp[c]++;
}
for (int i= 0;i < temp.length;i++){
if ( i == temp.length -1 && min == Integer.MAX_VALUE) return -1;
if (temp[i] == 1) min = Math.min(s.indexOf(i),min);
}
return min;
}
}
```