Give a two-dimensional array T with base type String and some string str (which can be treated like an array of type String) I want to check if T contains certain parts str as its entries. I tried this:
int indeksck = str.indexOf("C");
while(k<T.length){
if(T[k][2] == str.substring(indeksck+1)){
if(T[k][1] == str.substring(6, indeksck)){
int ile_o = Integer.parseInt(T[k][0]);
T[k][0]= Integer.toString(ile_o+1);
T[k][3] = T[k][3]+"X"+str.substring(1,6);
k = T.length+1;
} else {
k++;
}
} else {
k++;
if(k==T.length){
k = 0;
while(k<T.length){
if(T[k][0]==null){
T[k][0] = Integer.toString(1);
T[k][1] = str.substring(6,indeksck);
T[k][2] = str.substring(indeksck+1);
T[k][3] = str.substring(1,6);
k = T.length+1;
} else {
k++;
}
}
}
}
}
The problem is that the first part of my code is being ignored (even when condition should be satisfied). I would appreciate and suggestions on solving this problem.