code: private SortedClassProbability[] sortByDescendingClassProbability(String[] domainValues, double[] classProbabilities) {
      assert (classProbabilities.length == domainValues.length);
      SortedClassProbability[] arr = new SortedClassProbability[domainValues.length];
      for (int i = 0; i < domainValues.length; i++) {
        arr[i] = new SortedClassProbability();
        arr[i].name = domainValues[i];
        arr[i].probability = classProbabilities[i];
      }
      Arrays.sort(arr, Collections.reverseOrder());
      return arr;
    }
docs: Sort in descending order.