title: Java fill an array with non duplicate records
body: <pre><code>Scanner sc=new Scanner(System.in);
  int i=0;
  int nr = sc.nextInt();
  
  int[] arr=new int[5];
  while (i&lt;arr.length || arr[i] &lt; 11 ){
      System.out.println("Enter "+i+" index of array: ");
      int j = 0;
      if (arr[i]==arr[j]) {
          arr[i]=sc.nextInt();
          i++;
      }
  }
  System.out.println(Arrays.toString(arr));
  </code></pre>
  
  <p>How can I insert into an array only those values that are not repeated twice and the value should not pass 11,or else ask the user again.Please help,Stuck!</p>