Question: My code prints the result of converting n into base B. I am using % in my code. If % of two numbers gives an output of for example "11", how to I separate the digits so my output looks like "1 1"

```
        String s;
        int r;

        if(n < b){
            return n + " ";
        }else{
            s = converting(n/b,b);
            r = (n % b);
        }
        return s + r;
    }

    public static void main(String[] args) {
        Scanner scnr = new Scanner (System.in);
        RecursionMethod num = new RecursionMethod();
        System.out.println("Enter Values: ");
        System.out.print("B: ");
        int first = scnr.nextInt();
        System.out.print("B: ");
        int second = scnr.nextInt();
        System.out.println("Result: " + num.converting(first,second));
        scnr.close();
    }
}

```

Answer: 
One option would be to convert it to a string, then use string functions to do it. 

So:

```
int result = num.converting(first,second);
String strResults = String.valueOf(result);
System.out.println("Result: " + strResults.substring(0,0) + " " + strResults.substring(1, 1));

```

Depending on the types of results you expect you may have to make a more general case than this to handle more than 2 digits.

There would also likely be a way to it with printf formatting, but I've never liked printf formatting.
Why not do the base conversion via [Integer.toString(int i, int radix)](https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#toString(int,%20int)), where radix is just a fancy word for base, then use string manipulation as David Findlay suggests (though I'd probably use String#join and String#split), e.g.:

```
String converted = Integer.toString(n, b);
String spaceSeparated = (String.join(" ", converted.split("")));

```