public static int[] findSubstringIndex(String text, String pattern){
		SuffixTree st = new SuffixTree(text);
		SuffixTreeNode current = st.root;
		List<SuffixTreeNode> indexLeaves = new ArrayList<SuffixTreeNode>();
		int pointer = 0;
		while(pointer<pattern.length()){
			SuffixTreeNode next = st.searchEndChild(current, pattern.charAt(pointer));
			if(next!=null){
				current = next;
				int matchPtr = current.cut;
				while(matchPtr<=current.end){
					if(current.stringRepr.charAt(matchPtr++-current.start)!=pattern.charAt(pointer++)){
						return new int[0];
					}
					if(pointer>=pattern.length()){
						indexLeaves = findAllLeaves(current);
						int[] res = new int[indexLeaves.size()];
						for(int i=0;i<res.length;i++){
							res[i]=indexLeaves.get(i).start;
						}
						return res;
					}
				}
			}else{
				return new int[0];
			}
		}
		throw new IllegalStateException();
	}