You could use commons lang's ArrayUtils.

array = ArrayUtils.removeElement(array, element)

commons.apache.org library:Javadocs

Answer from Peter Lawrey on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › java › remove-an-element-at-specific-index-from-an-array-in-java
Remove an Element at Specific Index from an Array in Java - GeeksforGeeks
July 11, 2025 - Explanation: This example includes finding the element at the specified index and then removing that element. The rest of the elements are copied into a new array. This would lead to an array of size one less than the original array.
🌐
DigitalOcean
digitalocean.com › community › tutorials › java-remove-array-elements
How to Remove Array Elements in Java | DigitalOcean
May 2, 2025 - It can be used to remove an element from an array by copying all elements before the element to be removed, and then copying all elements after the element to be removed, starting from the position of the element to be removed. This method is more efficient than manual shifting but still requires ...
🌐
w3resource
w3resource.com › java-exercises › array › java-array-exercise-7.php
Java - Remove a specific element from an array
// Import the Arrays class from ... // Print the original array using Arrays.toString() method. System.out.println("Original Array : " + Arrays.toString(my_array)); // Define the index of the element to be removed (second element, ...
🌐
TutorialsPoint
tutorialspoint.com › home › java_data_structures › remove elements from array in java
Remove Elements from Array in Java
September 1, 2008 - Consider LA is a linear array with N elements and K is a positive integer such that K<=N. Following is the algorithm to delete an element available at the Kth position of LA. Step 1 - Start Step 2 - Set J = K Step 3 - Repeat steps 4 and 5 while ...
🌐
W3Schools
w3schools.com › java › ref_arraylist_remove.asp
Java ArrayList remove() Method
If a value is specified and multiple elements in the list have the same value then only the first one is deleted. If the list contains integers and you want to delete an integer based on its value you will need to pass an Integer object. See More Examples below for an example. ... T refers to the data type of items in the list. Remove an integer from the list by position and by value: import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<Integer> list = new ArrayList<Integer>(); list.add(5); list.add(8); list.add(9); list.add(1); list.remove(Integer.valueOf(1)); // Remove by object list.remove(1); // Remove by index System.out.println(list); } }
🌐
Stack Abuse
stackabuse.com › remove-element-from-an-array-in-java
Remove Element from an Array in Java
December 16, 2021 - Though, we can also copy an array, or a part of it, into itself. This allows us to shift a part of it to the left like last time: int[] array = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; int index = 3; To remove the element, we only need to write this one line of code:
🌐
Software Testing Help
softwaretestinghelp.com › home › java › remove/delete an element from an array in java
Remove/Delete An Element From An Array In Java
April 1, 2025 - Using Java8 streams, we can delete an element from an array. In order to do this, first, the array is converted to a stream. Then the element at the specified index is deleted using the filter method of streams.
Find elsewhere
🌐
Netjstech
netjstech.com › 2017 › 07 › how-to-remove-elements-from-array-java.html
How to Remove Elements From an Array Java Program | Tech Tutorials
When you remove an element from an array, you can fill the empty space with 0, space or null depending on whether it is a primitive array, string array or an Object array. Other alternative is to create a new array and copy the elements in that array. New array should have size of old array’s ...
🌐
Java67
java67.com › 2012 › 12 › how-to-remove-element-from-array-in-java-example.html
How to Remove an Element from Array in Java with Example | Java67
... There is no direct way to remove elements from an Array in Java. Though Array in Java objects, it doesn't provide any methods to add(), remove(), or search an element in Array.
🌐
Java Code Geeks
examples.javacodegeeks.com › home › java development › core java
Remove element from an Array Java Example
July 6, 2022 - In this tutorial, we learned how to remove an element from a given array. Developers can download the sample application as an Eclipse project in the Downloads section. This was an example of removing an element from a given array.
🌐
How to do in Java
howtodoinjava.com › home › java array › removing items from an array in java
Removing Items from an Array in Java
February 10, 2022 - Learn to remove the array items in Java by the index positions as well as the item values using ArrayUtils, Collections APIs and custom code.
🌐
Stack Overflow
stackoverflow.com › questions › 59348581 › how-can-i-remove-an-element-from-array-in-java
How can i remove an element from array in Java - Stack Overflow
An array might be ill-suited for your purposes, so consider using a list or an ArrayList. A list can be resized, so removing an element will automatically shorten the list. I recommend you look into that. Lastly, you currently aren't even comparing your input to your fields. Replace name = names[i-1]; with something along the lines of · if(name.equals(names[i])) //TODO: Remove from list
🌐
Codecademy
codecademy.com › docs › java › arraylist › .remove()
Java | ArrayList | .remove() | Codecademy
March 21, 2022 - Beginner Friendly.Beginner Friendly17 ... by value or index: ... In the example below, an empty ArrayList instance studentList is created and can hold String-type elements....
🌐
Java Guides
javaguides.net › 2024 › 05 › java-remove-element-from-array.html
Java: Remove Element from Array
May 29, 2024 - This guide will cover different ways to remove an element from an array, including using loops, the System.arraycopy method, and converting the array to a list and back to an array. ... In Java, arrays are fixed-size data structures that store elements of the same type.
🌐
GeeksforGeeks
geeksforgeeks.org › java › remove-all-occurrences-of-an-element-from-array-in-java
Remove all Occurrences of an Element from Array in Java - GeeksforGeeks
July 11, 2025 - ... // Java program remove all ... Driver Class public class Geeks { // Main Method public static void main(String[] args) { Integer[] a = { 3, 9, 2, 3, 1, 7, 2, 3, 5 }; // Element to be removed Integer k = 3; // Convert array ...
🌐
TutorialsPoint
tutorialspoint.com › home › java/util › java arraylist remove method
Java ArrayList remove Method
September 1, 2008 - The Java ArrayList remove(Object) method removes the first occurrence of the specified element from this list, if it is present.If the list does not contain the element, it is unchanged. Following is the declaration for java.util.ArrayList.remove() method ... This method returns true if this list contained the specified element, else the list is unchanged. ... The following example shows the usage of Java ArrayList remove(index) method.
🌐
Quora
quora.com › How-does-one-remove-an-element-from-an-array-in-Java
How does one remove an element from an array in Java? - Quora
Answer (1 of 10): Removing an element from an array is a cumbersome effort if the order matters in your array. Otherwise, it is really easy. Let me explain both ways. Order of the elements does NOT matter Let’s assume your have a partially filled array [5, 9, 6, 8, 0, 0, 0] (0 means don’t ...