title: i want to count occurrence of each word in a given sentence in java
body: <p><strong>beginner at java was asked in an interview</strong> 
  here i have to count the occurrence of each word in a given sentence.
  for eg( "chair is equal to chair but not equal to table."
             Output : chair :2,
                      is :1,
                      equal :2,
                      to :2,
                      but :1,
                      not :1,
                      table :1 )
  I have written some part of the code and tried using for loop but i failed.... </p>
  
  <pre><code>public static void main(String[] args) 
  {
              int counter = 0;
     String a = " To associate myself with an organization that provides a challenging job and an opportunity to provide innovative and diligent work."; 
  
     String[] b =a.split(" "); //stored in array and splitted
  
   for(int i=0;i&lt;b.length;i++)
   { 
       counter=0;
       for(int j&lt;b.length;j&gt;0;j--)
       {      
           if(b[i] = b[j])
            //
  
  
       }
   }       
  }
  </code></pre>
  
  <p>}</p>