title: Need to find and store the duplicate numbers in a array in another array but dont know how to put the duplicate's in another array
body: <p>I have found out the duplicate numbers in the array "a" but could not store the duplicate ones in another array "b". Any help much appreciated!</p>
  
  <p>Here is my code: </p>
  
  <pre><code>public static void main(String[] args) {
      int[] a = {1,2,3,3,5,6,1,7,7};
      int[] b={};
  
  
      for (int i = 0; i &lt; a.length; i++) {
          for (int j = i+1; j &lt; a.length; j++) {
              if(a[i]==(a[j])){
                  System.out.println(a[j]);
  
              }
  
          }
      }       
  </code></pre>