How to find the frequency of each and every word in a String, any body can tell why outputs are not coming correct?

count
frequency
java
string

#1

public class FindFreq{

public static void main(String...s){
	String para="hello hello this is a mis mistake r u r u ready to solve this ";
	char parachar[]=para.toCharArray();
	int first=0,last=0,index=0;
	String[] wordArray=new String[20];
	for(int i=0;i<parachar.length-1;i++){
					char temp='a';
					String tempWord="";
					first=i;
					while(temp!=' '){
							temp=parachar*;
							i++;
							}
							last=--i;
					for(int j=first;j<last;j++){
							tempWord=tempWord+parachar[j];
								   }
					wordArray[index]=tempWord;
					index++;
					   }
	for(int i=0;i<wordArray.length;i++){
		int fre=0;
		for(int j=0;j<wordArray.length;j++){
						if(wordArray*==wordArray[j])
							fre++;
			
						    }
					System.out.println(wordArray*+" Frequency="+fre);
						}		

	}

}


#2

You can use map<string, int>.
For every word, increment corresponding node.