编辑代码

class Main {
	public static void main(String[] args) {
      int a= FindTest("de","abcdefg");
      System.out.print(a);
	}


    static int  FindTest(String key,String test){
    int a=-1;
    int b=key.length();
    int c=test.length();
   
    if(b==0||c==0)
        return i;

    for(int i=0;i<c-b;i++){
        int j=0;
        for(j;j<b;j++)
        {
            if(test[i]!=key[j])
            break;
        }
        if(j==b){
            a=i;
            break;
        }


    }

    return a;

}

}