code: public void sort(Object[] array, boolean reverse) {
          
          // handle purely comparable arrays
          if (array instanceof Comparable[]) {
              if (reverse) {
                  Arrays.sort(array, Collections.reverseOrder());
              }
              else {
                  Arrays.sort(array);
              }
          }
          
          // otherwise, use general toString comparator
          else {
              if (reverse) {
                  Arrays.sort(array, TOSTRING_COMPARATOR_DESC);
              }
              else {
                  Arrays.sort(array, TOSTRING_COMPARATOR_ASC);
              }
          }
      }
docs: Sort the given array according to either the natural ordering of the
  array or using a generic string comparison by converting each element to
  its string format via {@link Object#toString() toString}.
  
  @param array The array to sort
  @param reverse The state of whether to reverse the sort