code: public void setScales(final double[] newScaleDenominators) {
          TreeSet<Double> sortedSet = new TreeSet<>(Collections.reverseOrder());
          for (final double newScaleDenominator: newScaleDenominators) {
              sortedSet.add(newScaleDenominator);
          }
          this.scaleDenominators = new double[sortedSet.size()];
          int i = 0;
          for (Double scaleDenominator: sortedSet) {
              this.scaleDenominators[i] = scaleDenominator;
              i++;
          }
      }
docs: Set the scales (sorts from largest to smallest).
  
  @param newScaleDenominators The scales (may be unsorted).