List of utility methods to do Array Concatenate
T[] | concatAll(T[] first, T[]... rest) concat All int totalLength = first.length; for (T[] array : rest) { totalLength += array.length; T[] result = Arrays.copyOf(first, totalLength); int offset = first.length; for (T[] array : rest) { System.arraycopy(array, 0, result, offset, array.length); ... |
byte[] | concatAllArrays(byte[] data1, byte[]... remaining) concat All Arrays int bufLength = data1.length; for (byte[] arr : remaining) { if (arr.length == 0) { return data1; bufLength += arr.length; int offset = data1.length; ... |
byte[] | concatArray(byte data1[], byte data2[]) concat Array byte temp[] = new byte[data1.length + data2.length]; System.arraycopy(data1, 0, temp, 0, data1.length); System.arraycopy(data2, 0, temp, data1.length, data2.length); return (temp); |
byte[] | concatArray(byte[] old1, byte[] old2) concat Array byte[] newArray = new byte[old1.length + old2.length]; System.arraycopy(old1, 0, newArray, 0, old1.length); System.arraycopy(old2, 0, newArray, old1.length, old2.length); return newArray; |
String | concatArray(int[] src, String separator) concat Array if (src.length == 0) { return null; if (src.length <= 1) { return String.valueOf(src[0]); StringBuilder builder = new StringBuilder(); builder.append(src[0]); ... |
String | concatArray(Object... objects) Turns all passed objects to strings using their toString() method and concatenates the results. return concatArray(new StringBuilder(), objects).toString(); |
Object[] | concatArray(Object[] arr1, Object newValue) concat Array Object[] arr2 = new Object[1]; arr2[0] = newValue; return concatArray(arr1, arr2); |
String | concatArray(String string, String[] words) concat Array StringBuilder concat = new StringBuilder(); for (int i = 0; i < words.length; i++) { concat.append(words[i] + " "); return concat.toString().trim(); |
String | concatArray(String[] array, int start) concat Array String str = array[start]; for (int i = start + 1; i < array.length; i++) { str = str + " " + array[i]; return str; |
String | concatArray(String[] array, int start, String def) concat Array if (array.length <= start) return def; if (array.length <= start + 1) return array[start]; String ret = array[start]; for (int i = start + 1; i < array.length; i++) { ret += " " + array[i]; return ret; |