public void sortColorsTwoPass(int[] A) {

		int zeroCount = 0;
		int oneCount = 0;

		for (int a : A) {
			if (a == 0) {
				zeroCount++;
			} else if (a == 1) {
				oneCount++;
			}
		}
		for (int i = 0; i < A.length; i++) {
			if (i < zeroCount) {
				A[i] = 0;
			} else if (i >= zeroCount && i < zeroCount + oneCount) {
				A[i] = 1;
			} else if (i >= zeroCount + oneCount) {
				A[i] = 2;
			}
		}
	}