Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java array merge

    public static void main(String[] args) {

        int[] x = {1, 2, 3};
        int[] y = {4, 5, 6};
        int[] merge = new int[x.length + y.length];

        for (int i = 0; i < x.length; i++) {
            merge[i] += x[i];
        }

        for (int i = 0; i < y.length; i++) {
            merge[x.length + i] += y[i];
        }

        System.out.println(Arrays.toString(merge));
    }
Comment

PREVIOUS NEXT
Code Example
Java :: treeset java descending order using comparator 
Java :: mod 10e9+7 in java 
Java :: how to make a button disapear on click in javafx 
Java :: how to copy an object in java 
Java :: why are my if statements not working with inputs in java 
Java :: types of methods in java 
Java :: java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider 
Java :: Java Program to Change the Border of a JFrame: 
Java :: math square java 
Java :: Java No-Arg Constructors 
Java :: java run jnlp 
Java :: Error inflating class android.support.design.widget.CoordinatorLayout 
Java :: sort arrays by first element java 
Java :: java clear scanner 
Java :: all possible substrings of a string java of specific length 
Java :: java linkedlist poll 
Java :: feign client url from properties 
Java :: Simple For Loop Java Example 
Java :: java loop through array 
Java :: radiogroup get selected item android 
Java :: how to find a word in a statement java 
Java :: url string from url java 
Java :: java complex numbers 
Java :: control structures in java 
Java :: creating an object in java 
Java :: java convert char to charsequence 
Java :: android studio convert java to kotlin 
Java :: spring swagger ui login oauth2 
Java :: java long literal 
Java :: Find Length of String using length() 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =