code: public int[] getBestAssignment() {
      double maxValue = Double.NEGATIVE_INFINITY;
      for (int i = 0; i < values.length; i++) if (values[i] > maxValue) {
        maxValue = values[i];
      }
  
      // OPTIMIZATION:
      // Rather than use the standard iterator, which creates lots of int[] arrays on the heap, which need to be GC'd,
      // we use the fast version that just mutates one array. Since this is read once for us here, this is ideal.
  
      Iterator<int[]> fastPassByReferenceIterator = fastPassByReferenceIterator();
      do {
        int[] assignment = fastPassByReferenceIterator.next();
        double v = getAssignmentLogValue(assignment);
        if (v == maxValue) return assignment;
      } while (fastPassByReferenceIterator.hasNext());
  
      throw new IllegalStateException("This is unreachable.");
    }
docs: Returns the highest value assignment to this TableFactor
  @return an array of variable assignments, corresponding to the variables listed in neighborIndices, that has the
  highest value