code: public static double[] getBorders(int numberOfBins, List<Double> counts) {
          Collections.sort(counts);
          if (!counts.isEmpty()) {
              List<Integer> borderInds = findBordersNaive(numberOfBins, counts);
              if (borderInds == null) {
                  borderInds = findBorderIndsByRepeatedDividing(numberOfBins, counts);
              }
              double[] result = new double[borderInds.size()];
              for (int i = 0; i < result.length; i++) {
                  result[i] = counts.get(borderInds.get(i));
              }
              return result;
          } else
              return new double[]{0.0};
      }
docs: Carefull, this method sorts the counts list!