Removing duplicate elements from Array in Core Java
<p><strong>Without using collections</strong>,i have written a java program to remove duplicate integer element from an integer array,however the program is removing only one integer element and other integer element is left over.</p>

<p>Could you let me know how should i remove duplicate integer elements in the below core java program.In the below core java program i have to remove the duplicate integer element 5 </p>

<p>Help provided will be appreciated.</p>

<p>Below is the Java code.</p>

<pre><code>import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class DeleteElementFromArray {

    static int[] a = {5,1,2,3,4,5,7,8,9,10};
    static int[] b = new int[10];
    static int i, k, f, j = 0;
    static int l = a.length;

    void DeletElementInt() {
         for (i = 0; i &lt; l; i++) {
             if (i != k) {
                   if (i &lt; k) {
                       b[i] = a[i];
                   } else{                    
                         b[i - 1] = a[i];
                   }  
             }
         }
     }       



    public static void main(String[] args) {
          DeleteElementFromArray d = new DeleteElementFromArray();
          System.out.println("Array Elements are ");
          for (i = 0; i &lt; l; i++){
            System.out.println(a[i]); 
          }
          InputStreamReader is = new InputStreamReader(System.in);
          BufferedReader br = new BufferedReader(is);
          System.out.println("Enter the Element for Delete");
          try {
             String s = br.readLine();
             f = Integer.parseInt(s);
              for (i = 0; i &lt; l; i++) {
                if (f == a[i]) {
                  System.out.println("Delete Element found from given array");
                  k = i;
                  j++;
                  d.DeletElementInt();
                }
              }
                 l = l - 1;
                 System.out.println("New Array ");
                 for (i = 0; i &lt; l; i++) 
                 {
                      System.out.println(b[i]);
                 }
                 if (j == 0) {
                   System.out.println("Entered Element does not found from given array");
                 }
          } catch (IOException e) {
                System.out.println(e);
          }
    }
}


//output
/*
Array Elements are 
5
1
2
3
4
5
7
8
9
10
Enter the Element for Delete
5
Delete Element found from given array
New Array 
1
2
3
4
5
7
8
9
10
*/
</code></pre>
