Here you can find the source of merge(int[]... arrs)
public static int[] merge(int[]... arrs)
//package com.java2s; //License from project: Open Source License public class Main { public static int[] merge(int[]... arrs) { int[] result = new int[0]; if (arrs != null) { int count = 0; for (int i = 0; i < arrs.length; i++) { count += arrs[i].length; }//ww w .ja v a 2 s . c o m result = new int[count]; int arg; int k = 0; for (int i = 0; i < arrs.length; i++) { if (arrs[i] == null) { continue; } for (int j = 0; j < arrs[i].length; j++) { arg = arrs[i][j]; result[k] = arg; k++; } } } return result; } public static char[] merge(char[]... arrs) { char[] result = new char[0]; if (arrs != null) { char count = 0; for (char i = 0; i < arrs.length; i++) { count += arrs[i].length; } result = new char[count]; char arg; char k = 0; for (char i = 0; i < arrs.length; i++) { if (arrs[i] == null) { continue; } for (char j = 0; j < arrs[i].length; j++) { arg = arrs[i][j]; result[k] = arg; k++; } } } return result; } public static byte[] merge(byte[]... arrs) { byte[] result = new byte[0]; if (arrs != null) { byte count = 0; for (byte i = 0; i < arrs.length; i++) { count += arrs[i].length; } result = new byte[count]; byte arg; byte k = 0; for (byte i = 0; i < arrs.length; i++) { if (arrs[i] == null) { continue; } for (byte j = 0; j < arrs[i].length; j++) { arg = arrs[i][j]; result[k] = arg; k++; } } } return result; } public static Object[] merge(Object[]... arrs) { Object[] result = new Object[0]; if (arrs != null) { int count = 0; for (int i = 0; i < arrs.length; i++) { count += arrs[i].length; } result = new Object[count]; Object arg; int k = 0; for (int i = 0; i < arrs.length; i++) { if (arrs[i] == null) { continue; } for (int j = 0; j < arrs[i].length; j++) { arg = arrs[i][j]; result[k] = arg; k++; } } } return result; } public static String[] merge(String[]... arrs) { String[] result = new String[0]; if (arrs != null) { int count = 0; for (int i = 0; i < arrs.length; i++) { count += arrs[i].length; } result = new String[count]; String arg; int k = 0; for (int i = 0; i < arrs.length; i++) { if (arrs[i] == null) { continue; } for (int j = 0; j < arrs[i].length; j++) { arg = arrs[i][j]; result[k] = arg; k++; } } } return result; } }