How to remove element from Array in Java with Example
For this example you will need to download commons-lang-2.6.jar and set it in your classpath. import java.util.Arrays; import org.apache.commons.lang.ArrayUtils; /** * * Java program to show how to remove element from Array in Java * This program shows How to use Apache Commons ArrayUtils to delete * elements from primitive array. * * @author http://javareinvented.blogspot.in */ public class RemoveObjectFromArray{ public static void main(String args[]) { //let's create an array for demonstration purpose int[] test = new int[] { 101, 102, 103, 104, 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 arr...