Here you can find the source of concatArray(Object[] arr1, Object newValue)
public static Object[] concatArray(Object[] arr1, Object newValue)
//package com.java2s; public class Main { public static Object[] concatArray(Object[] arr1, Object newValue) { Object[] arr2 = new Object[1]; arr2[0] = newValue;//w w w. j a va2s.c o m return concatArray(arr1, arr2); } public static Object[] concatArray(Object[] arr1, Object[] arr2) { int cnt = 0; if (arr1 != null) { cnt += arr1.length; } if (arr2 != null) { cnt += arr2.length; } if (cnt == 0) { return null; } int idx = 0; Object[] retValue = new Object[cnt]; if (arr1 != null) { for (int i = 0; i < arr1.length; i++) { retValue[idx++] = arr1[i]; } } if (arr2 != null) { for (int i = 0; i < arr2.length; i++) { retValue[idx++] = arr2[i]; } } assert (cnt == retValue.length); return retValue; } }