Consider changing these instances of Byte to Integer:
|
List<Byte> digits = new ArrayList<Byte>(); |
and eliminating this cast:
It is easy to overflow a
Byte. Moreover, because a
Byte is signed, an overflow can result in a negative value and an
ArrayIndexOutOfBoundsException on this line:
|
int was = res[digits.get(pos)]; |
Such was the case with a corpus I was using.