private int setupOrderPosition(int valuePosition, int startIndex, int endIndex) {
        swap(valuePosition, endIndex);
        int firstBiggerValuePosition = startIndex;

        for (int i = startIndex; i <= endIndex; i++) {
            if(array[i] <= array[endIndex]) {
                swap(i, firstBiggerValuePosition++);
            }
        }

        return firstBiggerValuePosition - 1;
    }