Java Array Copy arraycopyAndInsertInt(final int[] src, final int idx, final int value)

Here you can find the source of arraycopyAndInsertInt(final int[] src, final int idx, final int value)

Description

arraycopy And Insert Int

License

Open Source License

Declaration

static int[] arraycopyAndInsertInt(final int[] src, final int idx, final int value) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static int[] arraycopyAndInsertInt(final int[] src, final int idx, final int value) {
        final int[] dst = new int[src.length + 1];

        // copy 'src' and insert 1 element(s) at position 'idx'
        System.arraycopy(src, 0, dst, 0, idx);
        dst[idx] = value;/*from   w ww  .j av a  2s  .  c  o m*/
        System.arraycopy(src, idx, dst, idx + 1, src.length - idx);

        return dst;
    }
}

Related

  1. arrayCopy(T[] objs)
  2. arraycopy(T[] src, int srcPos, T[] dest, int destPos, int length)
  3. arraycopy(T[] src, int srcPos, T[] dst, int len)
  4. arrayCopy(T[] x)
  5. arrayCopyAndAddEntry(T[] base, T extra)
  6. arrayCopyToNull(T[] source, int sourceOffset, T[] destination, int destinationOffset)
  7. arrayCopyWithRemoval(Object[] src, Object[] dst, int idxToRemove)
  8. Arrays_copyOf(int[] pos, int length)
  9. copy(byte[] bytes)