Determining average of integers using quicksort
Just a few comments:

You can't really hope that your quicksort will be faster than what Java provides. I'm not saying, it can't be done, but it'd take an excellent programmer a few days at best.

So let's forget this part... and now to your algorithm. After some reformatting, I might understand it:

int result = 0;

for (int k = 0; k &lt; n; k++) {
    int desired = 2 * a[k];
    int l = 0;
    int r = n-1;
    while (l &lt; r) {
        int diff = a[l] + a[r] - desired;
        // made symmetric
        if (diff &lt; 0) {
            l++;
        } else if (diff &gt; 0) {
            r--;
        } else {
            result++;
            break;
        }
    }
}


You really seem to be doing what you stated. The total time is quadratic, so let's forget the sorting once again.

Some better variable naming would surely do no harm.

I'll come back when I get an idea concerning the speed.