You can get any occurrence of a substring in a string with a recursive method like this without any libraries:
import java.util.Arrays;
public class Test {
    public static void main(String[] args) {
        String word = "unrestfulness";
        String[] temp = new String[word.length()];
        for (char c : word.toCharArray()) {
            int count = (int) Arrays.stream(temp).filter(e -> e != null && e.contains(String.valueOf(c))).count();
            int index = getIndex(word, String.valueOf(c), count);
            System.out.println(c + " " + count + " " + index);
            temp[index] = String.valueOf(c);
        }
    
        System.out.println("result -> " + Arrays.toString(temp));
    }
    
    public static int getIndex(String word, String letter, int count) {
        return count == 0 ? word.indexOf(letter) : word.indexOf(letter, getIndex(word, letter, count - 1) + 1);
    }
}