title: How to remove the elements of an array which are equal in value?
body: <p>Using ArrayUtills in java code it is possible to remove an element from an java array.
  Below is the code which removes an element at a particlular index (in the code it is '2', which removes element value equalto '10'.</p>
  
  <pre><code>import java.util.Arrays;
  
  import org.apache.commons.lang3.ArrayUtils;
  
  
  public class RemoveObjectFromArray{
  
   public static void main(String args[]) {
  
  
       int[] test = new int[] { 10, 13, 10, 10, 105};
  
       System.out.println("Original Array : size : " + test.length );
       System.out.println("Contents : " + Arrays.toString(test));
  
       //let's remove or delete an element from Array using Apache Commons ArrayUtils
       test = ArrayUtils.remove(test, 2); //removing element at index 2
  
       //Size of array must be 1 less than original array after deleting an element
       System.out.println("Size of array after removing an element  : " + test.length);
       System.out.println("Content of Array after removing an object : "
                         + Arrays.toString(test));
  
   } }
  </code></pre>
  
  <p>It gives the output as:</p>
  
  <pre><code>run:
  Original Array : size : 5
  Contents : [10, 13, 10, 10, 105]
  Size of array after removing an element  : 4
  Content of Array after removing an object : [10, 13, 10, 105]
  </code></pre>
  
  <p>How the code can be amended to get the following output:</p>
  
  <pre><code>run:
  Original Array : size : 5
  Contents : [10, 13, 10, 10, 105]
  Size of array after removing an element  : 2
  Content of Array after removing an object : [ 13, 105]
  </code></pre>