code: private int[] alignCategoricals(String[] longerDomain, String[] shorterDomain) {
      String[] sortedLongerDomain = Arrays.copyOf(longerDomain, longerDomain.length);
      //Sort to make sure binary search is possible
      Arrays.sort(sortedLongerDomain);
  
      int[] transformedIndices = MemoryManager.malloc4(shorterDomain.length);
  
      for (int i = 0; i < shorterDomain.length; i++) {
        transformedIndices[i] = Arrays.binarySearch(sortedLongerDomain, shorterDomain[i]);
      }
  
      return transformedIndices;
    }
docs: Produces a mapping array with indexes of the smaller pointing to the larger domain.
  
  @param longerDomain Domain to originally map from
  @param shorterDomain Domain to originally map to
  @return Cross-domain mapping as an array of primitive integers