Created
October 30, 2015 18:58
-
-
Save edinak1/308ef18a3d5019505770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package masiv; | |
import java.util.Arrays; | |
public class Union { | |
public static void main(String[] args) { | |
int []data1={1,2,0,0,9}; | |
int []data2={0,8,7}; | |
System.out.println(Arrays.toString(union(data1,data2))); | |
} | |
static int [] union(int data1[],int data2[]) | |
{ | |
int [] data= new int[data1.length+data2.length]; | |
int i=0; | |
for(;i<data1.length;i++) | |
data[i]=data1[i]; | |
for(int k=0;k<data2.length;i++,k++) | |
data[i]=data2[k]; | |
return data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
А если массив data1 или data2 равны null?