Here you can find the source of addArray(int[] a, int p)
public static int[] addArray(int[] a, int p)
//package com.java2s; //License from project: LGPL public class Main { /**/*from ww w . j a v a 2s . c o m*/ * Add element to the end of the array */ public static int[] addArray(int[] a, int p) { int[] b = new int[a.length + 1]; System.arraycopy(a, 0, b, 0, a.length); b[a.length] = p; return b; } /** * Add element to the start of the array */ public static int[] addArray(int p, int[] a) { int[] b = new int[a.length + 1]; System.arraycopy(a, 0, b, 1, a.length); b[0] = p; return b; } }