I am creating a small java program that does some vector math, and I'm getting stuck with addition and subtraction.
We have to make our own vector class, and all it contains is an Array with its values, so
Vector a = new Vector(1, 2, 3) //this would make a vector with [1, 2, 3]
Vector b = new Vector(4, 3) //this would make a vector with [4, 3]
I cannot do vector addition a + b with what I have now, because if I loop over every index in Vector a, I would get an out of bounds error with Vector b.
How do I make a new array that has all the values of vector b with 0's for the rest, so
//a is [1, 2, 3]
//b is [4, 3]
fix = [4, 3, 0]; //same as b but with trailing 0's so a.length == fix.length