Question: Can you give me a hand please.

I need to do a check, to check if the userCode matches any code in my string array or if the oldUser code also matches any code from the array

```
String[] code = {"1111", "2222", "3333", "4444", "5555"};

String userCode;
String oldUser;

if (userCode.equals(code) || oldUser.equals(code)) {

RUN 

} else { die }

```

thanks

Answer: 
Loop the array and check each entry with your user values

```
 String[] code = {"1111", "2222", "3333", "4444", "5555"};

 for (int i = 0; i < code.length; i++) {
     if (userCode.equals(code[i]) || oldUser.equals(code[i])) {
          //do
     }
 }

```

Or using `Arrays.asList()`,

```
List<String> codes = Arrays.asList("1111", "2222", "3333", "4444", "5555");

if (codes.contains(userCode) || codes.contains(oldUser)) {
          //do
}

```
Use a foreach with a boolean var

```
boolean isTheSame;
For(String myArrayCodes; code;) {
  if (userCode.equals(myArrayCodes) || oldUser.equals(myArrayCodes))
    isTheSame = true;
  break;
  }
}

if (isTheSame) { // usercode or oldUser is on array
 doSomething();
}
else {
}

```