title: How to find matches between strings into two array - java
body: <p>I have two arrays containing some strings like the following:</p>
  
  <p>Array #1</p>
  
  <pre><code>abcd                    
  efgh            
  servicegroup_1
  ijkl 
  </code></pre>
  
  <p>Array #2</p>
  
  <pre><code>servicegroup_3
  servicegroup_1
  </code></pre>
  
  <p>I'd like to print a string like <code>"VERIFY: OK"</code> (on console) if the Array #1 contains at least one of the strings of Array #2. Otherwise, a string <code>"VERIFY: KO"</code> have to be printed.</p>
  
  <p>I implemented some code like the following:</p>
  
  <pre><code>for (int i = 0; i &lt; scopeFile.length; i++) {
                  for (String element : scopeJWT) {
                      if (scopeFile[i].contains(element)) {
                          ctx.setSendZuulResponse(true);
                          System.out.println(now + " --- " + "[Check Signature: OK]" + " [Verify Scope: OK]" + " [Verify expTime: OK]");
                      } else {
                          ctx.setSendZuulResponse(false);
                          ctx.setResponseStatusCode(HttpStatus.UNAUTHORIZED.value());
                          System.err.println(now + " --- " + "[VERIFY SCOPE: KO]");
                      }
                  }
  }
  </code></pre>
  
  <p>but, it returns both <code>VERIFY SCOPE: OK</code> and <code>VERIFY SCOPE: KO</code>, even if in considering the arrays I reported, I would have printed just <code>VERIFY SCOPE: OK</code>(because Array #1 contains <code>servicegroup_1</code>)</p>
  
  <p>Any ideas to fix my code? Thank you     </p>