title: remove number from array
body: <p>I need to write a program which for a given array of ints prints all its elements, but each value only once, without repetitions. That is my tutor said. I agree that there are several example here, but I have special conditions like:</p>
  
  <blockquote>
    <p>Do not create any auxiliary arrays, collections or Strings!</p>
    
    <p>Do not use any classes from packages other than the standard java.lang.</p>
  </blockquote>
  
  <p>I have been studying Java not so long so here is what I've done:</p>
  
  <pre><code>public class Third {
  
      public static void main(String[] args) {
          int[] p = {5, 2, 2, 5, -1, 5, 12, 2, 5, 44, 12, 9};
          remove(p);
      }
  
      static public void remove(int[] a) {
  
          int min = Integer.MIN_VALUE;
  
          for (int i = 0; i &lt; a.length; i++) {
              for (int j = i + 1; j &lt; a.length; j++) {
                  if (a[i] == a[j]) {
                      a[i] = min;
                  }
              }
          }
  
          for (int j = 0; j &lt; a.length; j++) {
              if (a[j] != min) {
                  System.out.println( a[j] );
              }
          }
  
      }
  
  }
  </code></pre>
  
  <p>I realize that this is not efficient, because it is not able to print int's min value. So is there any other way to do it correctly ?   </p>