How can I examine each digit of a BigInteger in Java?

biginteger, java

Solution

Straight-forward code prints digits from the last towards the first:

private static void printDigits(BigInteger num) {
    BigInteger[] resultAndRemainder;
    do {
        resultAndRemainder = num.divideAndRemainder(BigInteger.TEN);
        System.out.println(Math.abs(resultAndRemainder[1].intValue()));
        num = resultAndRemainder[0];
    } while (num.compareTo(BigInteger.ZERO) != 0);
}

Problem

How can I examine each digit (`System.out.println()` each digit, for instance) of a BigInteger in Java? Is there any other way other than converting it to a string?

Original source