I am looking for a clear explanation to my question (NOT looking for code), but if a bit of code helps to explain yourself, then please do.. thank you 🙂
Question:
-using Java
-Main class asks user for 2 integer inputs, then places them into 2 arraylists, of type integer. Each digit is broken up and stored in its own index, so it is its own “element”, so to speak.
For example, with my code right now, it goes something like this:
“Please enter an integer:”
688
“Please enter another integer:”
34
At this point now, internally, I have stored the input as 2 arraylists, that look like this:
ArrayList1: [6, 8, 8]
ArrayList2: [3, 4]
Now, lets say I want to perform some mutliplication, such as ArrayList1 * ArrayList2.
I’ll probably go ahead and create a temporary ‘result’ arraylist, then move that answer over to arraylist1 when my calculation is complete.
But the part I am having trouble with, is coming up with a systematic clear way to multiply the arraylists together. Keep in mind that this example uses an arraylist which represents an integer of length 3 and 2, respectively, but this could be anything. I could, for example, have an arraylist with 50 elements, such as [2, 4, 4, 3, 7, 3, 6, 3,………….] which could represent a huge number in the trillions, etc.
pseudo code: