So I'm trying to create a program that will take values from one array and multiply them with the values in the second array and then allocate the answer into a third array, then returning that array as a result
import java.util.Arrays;
public class ArrayCreator
{
public static void main( String[] args )
{
int [] L1;
int [] L2;
int n;
int m;
int index1;
int index2;
int index3;
int t;
int [] L3;
System.out.println("Please input the first array.");
L1=ITI1120.readIntLine();
System.out.println("Please input the second array.");
L2=ITI1120.readIntLine();
//BODY
n=L1.length;
m=L2.length;
L3=new int[n*m];
t=(n*m);
L3=L3Creator(L1,L2,L3);
System.out.println(Arrays.toString(L3));
}
private static int[] L3Creator(int [] L1, int [] L2, int [] L3)
{
int index1;
int index2;
int index3;
// BODY
for (index1=index2=index3=0;L3[index3]==L1[index1]*L2[index2];index3++)
{
if (index1<L1.length-1)
{
index1=index1+1;
}
else if (index1>=L1.length-1)
{
index1=0;
index2=index2+1;
}
}
return L3;
}
}
but for some reason the program prints [0,0,0,0] regardless of what numbers I put.
Any help would be appreciated!