private int divideGetPivotPos(int startIndex, int endIndex) {
        int pivotPos = getOptimalPos(startIndex, endIndex);
        int pivotValue = a[pivotPos];
        swap(a, endIndex, pivotPos);
        int firstGreaterPos = -1;
        for(int i = startIndex; i < endIndex; i++) {
            if(a[i] < pivotValue ) {
                if(firstGreaterPos == -1) continue;
                swap(a, i, firstGreaterPos);
                firstGreaterPos++;
            }
            else if(firstGreaterPos == -1) {
                firstGreaterPos = i;
            }
        }

        if(firstGreaterPos > -1) swap(a, firstGreaterPos, endIndex);
        return firstGreaterPos;
    }