code: private static int[] getUnionForAppendInstrumentationLevel(
                                                                 int[] oldCounters, int[] newCounters) {
  
          int[] merged = new int[newCounters.length + oldCounters.length];
          int i, j, k = -1;
  
          // Copying the Old Counters to the merged array
          for (i = 0; i < oldCounters.length; i++) {
              merged[i] = oldCounters[i];
              k++;
          }
  
          // Checking for the duplicate elements
          boolean flag = false;
          for (i = 0; i < newCounters.length; i++, flag = false) {
              for (j = 0; (j < oldCounters.length) && (flag == false); j++) {
                  if (newCounters[i] == oldCounters[j]) {
                      flag = true; // If the array element is a duplicate then
                      // breaking the loop.
                  }
              }
              if (flag == false) {
                  k++;
                  merged[k] = newCounters[i]; // If the array element is not
                  // present, then adding it to the
                  // Merged array.
              }
          }
  
          // Forming an array without duplicates.
          int[] final_result = new int[k + 1];
          for (i = 0; i <= k; i++)
              final_result[i] = merged[i];
          return final_result;
  
      }
docs: implementation