A way to optimize it would be to return as soon as you have found a duplicate, unless the question specifically asks you to list all duplicates.
You could refactor it to something like that:
public static boolean checkUnique(String s) {
int len = s.length();
for (int i = 0; i < len; i++) {
int c = s.codePointAt(i);
int lastnext = s.lastIndexOfindexOf(c, i + 1);
if (lastnext > i) {
return false;
}
}
return true;
}
It isn't more efficient as your solution, but I doubt there is an algorithm that can do it better.
BTW There is really no point to use ++i instead of i++.