title: THIS java.lang.ArrayIndexOutOfBoundsException ERROR
body: <pre><code>public static int StringInString(String one, String two) {
          if(one==null||two==null||one.equals("")||two.equals("")){
              return 0;
          }
          else{
              int x=one.length(),y=two.length(),sum=0,i=0,j=0;
              char[] onee=one.toCharArray();
              char[] twoo=two.toCharArray();
              while(i&lt;x){
                  while(j&lt;y){
                      if(onee[i]==twoo[j]){
                          i++;
                          j++;
                      }
                      else{
                          if(j==0){
                              i++;
                          }
                          else{
                              j=0; 
                              i++;
                          }
                      }
                  }
                  sum++;
                  i=i-y+1;
                  j=0;
              }
           return sum;
          }
      }
    public static void main(String[] args){
      int sum;
      sum = StringInString("salamsal","sal");
      System.out.println(sum);
  
   }
  </code></pre>
  
  <p>hello I dont know why this ERROR apear?! please HELP me;
  this code want count the similar text in two stringsa
  and the result of this code should be = 2.</p>