one for loop wraps 2 indexof method, what is the time efficiency? I'm confused about how to know the time / space efficiency. 


If there is an array whose size is n, do a for loop on this array, so that time efficiency should be O(n) = n, where n is array size. then if I have two indexof methods in the loop, indexOf and lastIndexOf, should the O(n) become n*(2n)? because each of the indexof methods has the time efficiency of n as well just like a for loop?
how to know the space efficiency of this method?


char firstNotRepeatingCharacter(String s) {

    char[] str = s.toCharArray();
    // n
    for (int i = 0; i &lt; str.length; i++) {

        char item = str[i];
        // 2n
        if(s.indexOf(item) == s.lastIndexOf(item)) return item;  

    }
    // 2n2

    return '_';
}
Yes, you are correct. But time complexity we measure only in big-O notation.

So the code above has time complexity $\mathcal O(n^2)$

The space complexity depends on indexof's space complexity. Assuming it was done with a for loop and a simple comparison, the space complexity would be $\mathcal O(log(n))$ - as the  storing the array length $n$ required $log(n)$ bits, and therefore keeping in memory the index i will take at most that much space.