I'd like to add (using the mathematical term) two Integer ArrayLists in Java, as well as divide them and multiply.
How would I go about this algorithmically? I can't for the life of me think of something, perhaps having to do with two's complements.
Okay, so let's say that I have large integers that are put into an ArrayLists, so to start off like 1233 and 1245. How would I divide those two with ArrayLists? a.get(i)? I could easily do it with an integer or a long, but if it had thousands of digits, that wouldn't work so well.
And yes, I'd like to add/divide the contents of the ArrayLists. If I used the get method and added them, I'd get something like [6,8,10,12] instead of that. But I guess I need to have single digits in each slot of the ArrayList. It's supposed to work similarly to BigInteger class in Java, but not use the BigInteger class.
ArrayList<Integer> a = [1,2,3,4,3,4,3,5,1,3]; ArrayList<Integer> b = [9,9,9,9,9,9,9,9,9,9,9]; ArrayList<Integer> c = [1,0,1,2,3,4,3,4,3,5,1,2]; //when adding or look like c = [1,2,3,4,3,4,3,5,1,2,9,8,7,6,5,6,5,6,4,8,7]; //when multiplying