combine two array in java

Solutions on MaxInterview for combine two array in java by the best coders in the world

showing results for - "combine two array in java"
Gabriele
17 Jan 2018
1import java.util.Arrays;
2
3public class Concat {
4
5    public static void main(String[] args) {
6        int[] array1 = {1, 2, 3};
7        int[] array2 = {4, 5, 6};
8
9        int aLen = array1.length;
10        int bLen = array2.length;
11        int[] result = new int[aLen + bLen];
12
13        System.arraycopy(array1, 0, result, 0, aLen);
14        System.arraycopy(array2, 0, result, aLen, bLen);
15
16        System.out.println(Arrays.toString(result));
17    }
18}
Gauthier
25 Aug 2020
1public static void main(String[] args) {
2
3// for each ile cozumu
4        String[] arr3 = {"A", "B", "C","Z","N"};
5        String[] arr4 = {"D", "E", "F","G","U"};
6
7ArrayList<String> list1 = new ArrayList<>(); //[A, B, C, Z, N, D, E, F, G, U]
8
9        for( String each: arr3 ){
10            list1.add( each );
11        }
12        for(String each1 : arr4  ){
13            list1.add(each1);
14        }
15        System.out.println(list1); // [A, B, C, Z, N, D, E, F, G, U]
16    }
17
Filippo
17 Jan 2019
1public static void main(String[] args) {
2
3// for each ile cozumu
4        String[] arr3 = {"A", "B", "C","Z","N"};
5        String[] arr4 = {"D", "E", "F","G","U"};
6
7ArrayList<String> list1 = new ArrayList<>(); 
8  //[A, B, C, Z, N, D, E, F, G, U]
9
10        for( String each: arr3 ){
11            list1.add( each );
12        }
13        for(String each1 : arr4  ){
14            list1.add(each1);
15        }
16        System.out.println(list1); // [A, B, C, Z, N, D, E, F, G, U]
17    }
queries leading to this page
add two array in javahow to concat 2 array in javahow to combine two arrays in one javaappend two arrays javaconcatenate integer array javawap to merge two arrays in javamerge 2 arrays javahow to concat two arrays javaadd two arrays javamerging two arrays in javacombine to arrays javajava merge arrayshow to fuze 2 arrays together javahow to join two arrays into one in javamerger 2 array in javajava program to merge two arrayshow to merge arrays into one new array javacombine 2 arrays javahow to merge two arrays with using third array in javaconcatenate four array javahow to concatenate to array javamerge to arrays javaconcat to arrays ajavahow to concat two arrays in javahow to connect two arrays in javamerge 2 arrays in javajava merge two arraysarray concat javaeasiest way to merge arrays javamerging of arrays in javaconcatenate 2 string arrays in javajava array concatenationmerge array javahow to merge three arrays in javaconcatenate two string arrays javahow to add 2 arrays javaconcate an array in javamerging array in javajava combine arraysmerging 2 arrays in javamerge two array in javajava how to combine arraytwo arrays in one javahow to combine 2 arrays in javaconcat multiple array in javahow to add two array in javajava how to combine arraysmerge to array in javaadd two arrays in one array in javahow to combine arrays javaconcat 2 arrays javaadding 2 arrays in javajava array concatenation methodconcat two array in javahow to put two arrays together javahow to merge two arrays in third array in javamerge 2 string arrays javajoin two array javahow to concat array in javaarray concatenation javamerge two arrays in javahow to join two integer arrays in javaconcat two arrays in javaconcat to arrays javajoin two arrays javaconcat array javamerging two arrays in java functionjava concat arrayconcatination of two arrays in javamerging two array in javamerging an array in javajava join two arrays togethercombine 2 arrays in javajava combine two arraysjava append two arrayshow to concatenate integer array elements in javaconcatenation of arraya javawrite a program to merge two arrays in javacreate array from two arrays javaadding two arrays java concatenate two arrays in javaarrays combineren javahow to concatenate an array in javajoin two int array javaconcat elements of array javamerge 3 arrays in place javamerge array in javaconcatenate array javaconcat 2 array javamerge two array javacombine two arrays in javajava add 2 arrays togetherconcatenarte two array in javaarray merge java concat array javahow to join two arrays in javajava array concatjava code to merge two arrayshow to concatenate an array javajava concatenate arraysprogram to merge two arrays in javahow to combine two integer arrays in javacombining two arrays in javaconcatenate two arrays javainserting two arrays in javajava merge arrays togetherjava merge 7e2 arraysmerge two arra in javajava join 2 arrayshow to merge to arrays in javajava concate arraysjava program to concatenate 2 arrayshow to merge arrays in javaarray concat in javahow to combine two arrays javasmerging arrays in javamerge two arrays javahow to concatenate the array of arrays in javacombine two arrays javaadd two arrays in javamerge arrays javaconcatenate two array javacombining arrays javamerge two different arrays in javaconcat two arrays javaadd 2 arrays in javahow to merge two arrays in javahow to merge arrays in javahow to concatenate array elements in javamerge array program in javahow to merge two arrays in java 3fhwo to join two arrays in javahow to merge an array in javajava combine 2 arrayshow to combine two arrays javamerge arrays in javaconcatenation of two arrays in javajava concat 2 arraysconcatinating arrays javaconcat arrays javacancatenate array javahow merge 2 arrays javamerge two int arrays javaadd 2 arrays javaappend two arrays in javahow to concat two string arrays in javamerge elements and a array javahow to concatenate two arrays in javajava concat arrayshow to concatinate two array in javahow to merge two string arrays in javaconcatinating two arrays in javajava concat arrays stringmarge array in javahow to conccat to two arrays in javajoin 2 arrays javajava concat ywo arrayscan you merge two arrays in javamerging of two arrays in javaconcatenating two arrays in javahow to combine two arrays in javajava merge contents of arrays togetherconcat array in javawrite a program to merge two arrays in third array in javaarray concat two arrays in javaconcatenate arrays javahow to merge to array in javahow to merge arrays javahow to combine all arrays into one javahow to merge two arrays inn javamerge two integer arrays in javajava concatenate 2 arrayshow to merge two array in javamerge function in java for arrayshow to append two arrays in javamerging arrays javajava how to merge two arrayshow to come concatenate arrays in javamerge 2 int array in javajava merge arrayhow to join 2 arrays javajava merge 2 arraysarray merge in javamerge multiple arrays java how to combine arrays in javahow to merge array in javaconcatenate two arrays in javahow to merge 2 arrays in javacombine two array in javahow to merge 2 arrys in javacombine two arrays javashow to add two arrays in javahow to merge two arrays javajoin two arrays in javacombine two array javaarrays concat javacombine arrays javacombine two array in java