package MyPac;
public class Sort {
public static int[] randomGenerator(int[]arr) {
int temp[] = new int[arr.length];
for(int i = 0; i < arr.length; i+=1){
temp
[i
] = (int) (Math.
random() * 100);
}
return temp;
}
public static int[] compareArr(int[] arr1, int[] arr2) {
int[] temp = new int[arr1.length + arr2.length];
for (int i = 0; i < arr1.length; i += 1) {
temp[i] = arr1[i];
}
for (int i = 0; i < arr2.length; i += 1) {
temp[arr1.length + i] = arr2[i];
}
/*compare the last 3 digits(the size of the second array) with the first 5 (the size of the first array)
eliminate any duplicate in the array*/
for(int i = 0; i < arr2.length; i +=1){
for (int k = 0; k < arr1.length; k+=1){
if(temp[i + arr1.length] == temp[k]){
temp[i + arr1.length] = -1;
temp[k] = -1;
}
}
}
return temp;
}
}
========================================================================================================================
package MyPac;
public class Tester {
public static void main
(String[] args
) {
int[] arr1 = new int[5];
int[] arr2 = new int[3];
int[] arr3;
arr1 = Sort.randomGenerator(arr1);
arr2 = Sort.randomGenerator(arr2);
arr3 = Sort.compareArr(arr1, arr2);
for(int i:arr3){
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}