Java Example | Remove an Element From Array

This java example code shows how to remove an element from an array.

int[] array = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
int index = 3;

for (int i = index; i < array.length - 1; i++) {
    array[i] = array[i + 1];
}

array will be:

10, 20, 30, 50, 60, 70, 80, 90, 100, 100