title: Without using the String methods - contains, indexOf, lastIndexOf determine whether the substring is in the string
body: <p>I don't know how to improve my code, because when i put in two spaces between <code>"small  Oleg"</code>, it shows <code>"contains"</code>, but it is falls. Because <code>"small Oleg"</code> isn't equals <code>"small  Oleg"</code>. Probably it can solve without split?</p>
  
  <pre><code>import java.util.Arrays;
  
  public class ContainsStr {
      public static void main(String[] args) {
          String s1 = "Hello small Oleg";
          String s2 = "small Oleg";
  
          String[] splitedS1 = s1.split("\\s+");
          String[] splitedS2 = s2.split("\\s+");
          String[] s3 = new String[splitedS2.length];
          for (int i = 0; i &lt; splitedS1.length; i++) {
              for (int j = 0; j &lt; splitedS2.length; j++) {
                  if (splitedS1[i].equalsIgnoreCase(splitedS2[j])) {
                      s3[j] = splitedS2[j];
                  }
              }
          }
          if (Arrays.equals(s3, splitedS2)) {
              System.out.println("Contains");
          } else {
              System.out.println("Not contains");
          }
  
      }
  }
  </code></pre>