Here you can find the source of arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove)
public static void arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove)
//package com.java2s; /******************************************************************************* * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*w w w . j a va 2 s . c om*/ * IBM Corporation - initial API and implementation *******************************************************************************/ public class Main { public static void arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove) { if (src == null || dst == null || src.length - 1 != dst.length || idxToRemove < 0 || idxToRemove >= src.length) { throw new IllegalArgumentException(); } if (idxToRemove == 0) { System.arraycopy(src, 1, dst, 0, src.length - 1); } else if (idxToRemove == src.length - 1) { System.arraycopy(src, 0, dst, 0, src.length - 1); } else { System.arraycopy(src, 0, dst, 0, idxToRemove); System.arraycopy(src, idxToRemove + 1, dst, idxToRemove, src.length - idxToRemove - 1); } } }