From what I understand, you want to compare two arrays that might not be the same size, and if they are not, then only compare up to the shortest size?
You can do something like this:
boolean equals = true;
for(int i = 0; i < test1.length && i < test2.length; i++) {
if(!test1[i].equals(test2[i])) {
equals = false;
break;
}
}
solved Comparing String (index) [duplicate]