Substring syntax errors in java, used Array List to find common words in a dictionary : I have an array of words from which I would like to select words which have 4 similar characters, for example key word is split, it would be give me words relating to that from the array. The code however gives me errors with the substring. 

Below is the code for your reference.

public class FourLetterInCommon {
	
	static String wrd = "split";
    static String[] d = new String[]{"SPLITS", "SPLITTED", "SPLITTER", "SPLITTERS", "SPLITTING", "SPLITTINGS", "SPLITTISM", "SPLITTISMS", "SPLITTIST", "SPLITTISTS"};
        
	public static void main(String[] args){
        System.out.println(fourletters (wrd, d));
    }  
	
	public static List<String> fourletters (String word, String[] dict){
		int dictsize = dict.length;
		int wordlength = word.length();
		
		List<String> Commonletters = new ArrayList<String>();
		
		for(int i = 0; i<=dictsize; i++) {
			for (int j=0; j<=wordlength;) {
				
				if(dict[i].contains(word.substring(i, 5)))
				{
					Commonletters.add(dict[i]);
				}
					
				break;
			}
			
		}
		return Commonletters;
	}
}
