Already answered by Evan Knowles and user3322273, but here is another implementation:
byte[] digits = b.getBytes();
for (byte digit : digits) {
System.out.println (digit & 0xf);
}
What it does is that it masks the (ASCII) value of the digit. For example:
'0' = 48 | In ASCII and Unicode - Decimal
= 110000 | In binary
Hence, if we obtain the last four bits, then we can get the number. So
48 & 0xf (i.e. 15)
= 11 0000
& 00 1111
= 0000
= 0 | Ultimately in decimal.