code: @SuppressWarnings("unchecked")
    public static <T> T[] remove(T[] array, int index) {
  
      Assert.notNull(array, "Array is required");
  
      assertThat(index).throwing(new ArrayIndexOutOfBoundsException(
        String.format("[%1$d] is not a valid index [0, %2$d] in the array", index, array.length)))
          .isGreaterThanEqualToAndLessThan(0, array.length);
  
      Class<?> componentType = defaultIfNull(array.getClass().getComponentType(), Object.class);
  
      T[] newArray = (T[]) Array.newInstance(componentType, array.length - 1);
  
      if (index > 0) {
        System.arraycopy(array, 0, newArray, 0, index);
      }
  
      if (index + 1 < array.length) {
        System.arraycopy(array, index + 1, newArray, index, (array.length - index - 1));
      }
  
      return newArray;
    }
docs: Removes the element at index from the given array.
  
  @param <T> {@link Class} type of the elements in the array.
  @param array array from which to remove the element at index.
  @param index index of the element to remove from the array.
  @return a new array with the element at index removed.
  @throws IllegalArgumentException if the given array is {@literal null}.
  @throws ArrayIndexOutOfBoundsException if the {@code index} is not valid.