I have 3 arrays example:
String[]arr1={"1150","3309","44","22","98","88","33","11","880"}
String[]arr2={"5","9","44","22","65","20","41","3","9","5"}
String[]arr3={"1","3","20","22","30","40","15","2","4","0"}
i want to get indexes for elements in the first array(arr1) that starts with ["11" , "88" , "33" ]
and after getting them I have to multiply the elements of the other two arrays with the same indexes example:"1150" Starts with "11","3309" starts with "33" so i have to multiply 1*5 , 9*3 ..etc and store the in some variable which I can't imagine what data structure should I use for it.
for (int k = 0; k < index - 1; k++) {
if (arr1[k].substring(0, 2).equals("11")
|| arr1[k].substring(0, 2).equals("88")
|| arr1[k].substring(0, 2).equals("33"))
{
//don't know what should i do then
}
}
I tried this:
Integer x=Integer.valueOf(arr2[k])* Integer.valueOf(arr3[k]);
but then I figured out that k should have many values for the different occurrences of my targeted strings. so this line caused me an error. any help would be appreciated thanks !
5*1and not9*4? Or are you supposed to do both but only provided an example for the first one?88that wasn't provided; My bad.