I hope I get your problem right:
You have arrays a and b and you want to know which entries in b are also contained in a.
There are multiple ways to do that but the simples way would be to do a for loop like this that checks if an individual entry is in a list:
String b[]={"Your","array"};
String element_to_be_checked="Your element";
for(int i=0;i<b.length;i++){
//To check if two strings are the same always use the equals method
if(b[i].equals(element_to_be_checked)){
println("Trait "+b[i]+"matches");
}
}
This can be combined with a for loop to check the the array of traits from what you entered.
I hope this helps.