I am making a BCD class as an exercise for school, and am encountering some issues. Below is my BCD class.
My problem is with the multiplyBCDs method. It works fine with smaller numbers such as 4,329 * 4, however, with larger products, such as the product of 4,329 and 29,385, I receive a NullPointerException error at the first line of my addBCDs method:
int[] added = new int[other.numberOfDigits()];
I have tried retracing the problem and could not find the issue. Why am I receiving this error and how could I fix it?
Thanks for the help!