title: Finding frequency of each element in an array
body: <p>I have made a java program where  i have to print the frequency of each element in the array only once without using Collections.
  Below is the Code which i implemented it.How to stop counting the element which i counted just now 
  for example 4 4.4 has occurred 2 times the next 4 hence should not be counted. </p>
  
  <pre><code>static void countdigit(int x[])
   {
     for(int pass=x.length;pass&gt;=0;pass--)
       {
         for(int i=0;i&lt;pass-1;i++)
          {
            if(x[i]&lt;x[i+1])
              {
                  int temp=x[i];
                  x[i]=x[i+1];
                  x[i+1]=temp;
              }
          }
       }
  
     int count=0;
     int p[]=new int[x.length];
     for(int i=0;i&lt;x.length;i++)
       { System.out.print(x[i]);     @Edit 1
         System.out.print(" ");
       }
      for(int i=0;i&lt;x.length;i++)
       { for(int j=0;j&lt;x.length;j++)
         {
          if(x[i]==x[j])
          {            
            count++;
          }
         }
           System.out.println();
           System.out.println(count);
  
           count=0;
       }
    } 
    public static void main(String s[])
   {
    countdigit(new int[] {1,4,4,2,3,4,3,3});   
   }
  }
  
  OutPutShown
  4 4 4 3 3 3 2 1 
  3
  
  3
  
  3
  
  3
  
  3
  
  3
  
  1
  
  1
  </code></pre>
  
  <p>i want output as  </p>
  
  <pre><code>  4 3, 
  
    3,3
  
    2,1
  
    1,1
  </code></pre>