private static OptionalInt collectToPercentile(int[] arr, double percentile)
    {
        if (nonNull(arr) && percentile > 100 || percentile < 0) throw new IllegalArgumentException("Wrong percentile! Must be 1-100");

        int[] sortedArr = Arrays.copyOf(arr,arr.length);
        Arrays.parallelSort(sortedArr);

        int percentilePtr = (int)Math.round(arr.length * percentile / 100) - 1;

        String arrStr = Arrays.stream(sortedArr).mapToObj(i -> i == sortedArr[percentilePtr] ? inGreen(String.valueOf(i)) : String.valueOf(i)).collect(joining(","));
        System.out.println(arrStr);
        return OptionalInt.of(sortedArr[percentilePtr]);
    }