title: Java program to find the duplicate values of an array of integer using simple loop
body: <pre><code>public class ArrayTest{
  
      public static void main(String[] args) {
  
          int array[] = {32,3,3,4,5,6,88,98,9,9,9,9,9,9,1,2,3,4,5,6,4,3,7,7,8,8,88,88};
  
          for(int i= 0;i&lt;array.length-1;i++){
              for(int j=i+1;j&lt;array.length;j++){
                  if((array[i])==(array[j]) &amp;&amp; (i != j)){
                      System.out.println("element occuring twice are:" + array[j]);
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>this program work fine but when i compile it, it print the values again and again i want to print the duplicate value once for example if 9 is present 5 times in array so it print 9 once and if 5 is present 6 times or more it simply print 5...and so on....this what i want to be done. but this program not behave like that so what am i missing here.</p>
  
  <p>your help would be highly appreciated.
  regards!</p>