public static int[] outerUnion(int[] firstArr, int[] secondArr) {
        if (firstArr == null || secondArr == null) {
            return new int[]{};
        }

        int[] outerUnion;
        int[] innerUnion = innerUnion(firstArr, secondArr);
        int numberInnerElements = innerUnion.length;
        int numberOfElements = (firstArr.length + secondArr.length) - numberInnerElements * 2;
        int elementsIndex = 0;

        outerUnion = new int[numberOfElements];
        for (int elem : firstArr) {
            int position = Arrays.binarySearch(innerUnion, elem);
            if (position < 0) {
                outerUnion[elementsIndex++] = elem;
            }
        }

        for (int elem : secondArr) {
            int position = Arrays.binarySearch(innerUnion, elem);
            if (position < 0) {
                outerUnion[elementsIndex++] = elem;
            }
        }

        return outerUnion;
    }