title: sorting an array and counting its elements
body: <p>I tried to sort an array accending and count the array elements
  please help me find whats missing, have debugged many times. here is my code and the output i got. Thanks   </p>
  
  <pre><code>package habeeb;
  
  import java.util.*;
  
  public class Habeeb {
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
          int[] num = new int[30];
          int i, count=0;
  
          System.out.println("Enter the integers between 1 and 100" );
  
          for( i=0; i&lt;num.length; i++){
              num[i]= input.nextInt();
              if(num[i]==0)
                  break;
              count++;
          }
  </code></pre>
  
  <p>calling the function here </p>
  
  <pre><code>        Sorting(num, i, count);
      }
  
      public static void Sorting(int[] sort, int a, int con){
          if (a&lt;0) return;
   /*am sorting the array here*/
          Arrays.sort(sort); 
          int j, count=0;
  
          for(j=0; j&lt;con; j++){
              if(sort[a]==sort[j])
                  count++;
          }
  
          System.out.println(sort[a]+" occurs "+count+" times"); 
          Sorting(sort, a-1, con);
      }
  }
  </code></pre>
  
  <p>Here is the output:</p>
  
  <pre><code>run:
  Enter the integers between 1 and 100
  2
  5
  4
  8
  1
  6
  0
  0 occurs 6 times
  0 occurs 6 times
  0 occurs 6 times
  0 occurs 6 times
  0 occurs 6 times
  0 occurs 6 times
  0 occurs 6 times
  </code></pre>