public static int indexOfSubString(String str,String sub){
		int curIndex=0;
		int subIndex=0;
		while(curIndex<str.length() && subIndex<sub.length()){
			//If it matches
			if(str.charAt(curIndex)==sub.charAt(subIndex)){
				curIndex++;
				subIndex++;
				continue;
			}else{
				//If it doesn't match, calc new curIndex and new subIndex
				if(subIndex==0){   //The first doesn't match
					curIndex++;  
					continue;
				}else{       //Match to some point
				    subIndex=calcNewPos(subIndex,sub);
					continue;
				}
			}
		}
		if(subIndex==sub.length()){
			return curIndex-subIndex;
		}
		
		return -1;
	}