title: Java + Count duplicates from int array without using any Collection or another intermediate Array
body: <p>As a part of the Java interview question paper I have got following issue to solve.
  But I am bit wonder whether how can I implement it without any Collection or intermediate Array.</p>
  
  <p>Question:- Count duplicates from int array without using any Collection or another intermediate Array </p>
  
  <pre><code>Input values:- {7,2,6,1,4,7,4,5,4,7,7,3, 1}  
  
  Output:- Number of duplicates values: 3
           Duplicates values: 7, 4, 1
  </code></pre>
  
  <p>I have implemented following solution but was not completed one. 
  Any one has some idea? Thanks.</p>
  
  <pre><code>public static void duplicate(int numbers[]) {
  
      for (int i = 0; i &lt; numbers.length; i++) {
  
          boolean duplicate = false;
          int j = 0;
  
          while (j &lt; i){
  
              if ((i != j) &amp;&amp; numbers[i] == numbers[j]) {
                  duplicate = true;
              }
  
              j++;
          }
  
          if (duplicate) {
              System.out.print(numbers[i] + " ");
          }
      }
  }
  </code></pre>