Android examples for java.lang:array union merge
concatenate array and return a new array
import java.lang.reflect.Array; import java.util.List; public class Main{ public static Object[] concatenate(Object[] first, Object[] second) { Object[] result = new Object[first.length + second.length]; for (int i = 0; i < first.length; i++) { result[i] = first[i];//from www . j av a 2 s.com } for (int i = 0; i < second.length; i++) { result[i + first.length] = second[i]; } return result; } public static int[] concatenate(int[] first, int[] second) { int[] result = new int[first.length + second.length]; for (int i = 0; i < first.length; i++) { result[i] = first[i]; } for (int i = 0; i < second.length; i++) { result[i + first.length] = second[i]; } return result; } public static boolean[] concatenate(boolean[] first, boolean[] second) { boolean[] result = new boolean[first.length + second.length]; for (int i = 0; i < first.length; i++) { result[i] = first[i]; } for (int i = 0; i < second.length; i++) { result[i + first.length] = second[i]; } return result; } }