Need help making extension

Hi, I was making extension for app inventor but I got stuck...

I am making an extension that can convert text to octal value & back again.. But while converting it back, it can just convert 1 octal value at a time, I tried with loops but failed!

Here is an sample code

String res = "";

    for (long i = 0; 1 < result.size(); i++) {
        char Char =  //  Main conversion in this line (I have deleted it)
        res = res + Char;

    System.out.println(res); // Output 

I need help converting more that 1 octal value at a time, also I asked this question in stackoverlflow but dint get answer till now...

This can be done with few steps in blocks editor, but I want extension to fully convert it...

Here is my octal list value

            result = new ArrayList<>(

Stack overflow has answered me also thanks to @WatermelonIce for helping me with loops.