public void sortColors(int[] A) {

		int zeroPointer = 0;
		int twoPointer = A.length - 1;

		for (int i = 0; i <= twoPointer; i++) {
			int curt = A[i];
			if (curt == 0) {
				if(i != zeroPointer) {
					// switch with zeroPointer
					A[i] = A[zeroPointer];
					A[zeroPointer] = curt;
					i--;					
				}
				zeroPointer++;
			} else if (curt == 1) {
				// go ahead
				continue;
			} else if (curt == 2) {
				// switch with twoPointer
				A[i] = A[twoPointer];
				A[twoPointer] = curt;
				twoPointer--;
				i--;
			}
		}
	}