1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
|
package sample;
public class Aufgabe13 {
public static void main(String[] args) {
int j = 0, u = 0;
int[] x = {1, 3, 4, 5, 5, 7};
int[] y = {2, 4, 5};
int length = x.length + y.length;
int[] z;
z = new int[length];
for (int i = 0; i < length; i++) {
if (u >= y.length || (j < x.length && x[j] <= y[u])) {
z[i] = x[j];
j++;
} else {
z[i] = y[u];
u++;
}
}
for (int b : z) {
System.out.println(b);
}
}
}
|