# Extra Credit (GOOD LUCK!)

Note first try addition , also worth some (though less) extra credit.

** int[] multiply(int[] num1, int[] num2, int base) throws ArithmeticException

@precondition `1 < base < 11`
@precondition `num1.length = 5 and num2.length = 5`
@postcondition: the returned array has 5 elements representing the product or an ArithmeticException is thrown

Description: This method attempts to replicate multiplication. Both num1 and num2 represent five digit numbers. Each element in the array stores one of the digits. For instance, the number 143 would be represented as {0,0,1,4,3 }. Numbers can be in any base between 2 and 10 inclusive , and the number 101102 in binary would appear in an arrays as : {1, 0, 1 , 1, 0 } . Let’s assume the numbers are positive. You should return an array representing the digits of the product of num1 and num2. If the number of digits in the product exceeds the maximum number of digits (5) , you should throw an arithmetic exception as shown in the code below:

Note: You may not use any kind of helper or utility methods that are built into pre-defined Java classes for converting numbers between bases. Only use techniques taught in this class.

 Method Call return value/output multiply ( {0,0,0 , 4,2},{0,0,0,5,1}, 10) {0 , 2 ,  1 ,  4 ,  2}    (42 *51= 2142) multiply ( {0,0,0, 3,1} , { 0 ,0,0,2,4}, 10) {0 , 0 ,  7 , 4 ,  4}    (31 *24= 744) multiply ( {6,5,1, 3,1} , { 0 ,0,0,2,4}, 10) throw an ArithmeticException

### Tool for checking work

Use programmers calc to check your work. This is an awesome 64 calculator and you can multiply in binary, decimal or octal to help you see if you did your work correctly.