public static int search2(int [] a,int p,int r){
		int x = a[p];
		int i = p - 1;
		int j = r + 1;
		while (true) {
			do {
				j = j - 1;
			} while (a[j] <= x);

			do {
				i = i + 1;
			} while (a[i] >= x);

			if (i < j) {
				swap(a, i, j);
			} else {
				return j;
			}
		}
	}