public void sortColors2Pass(int[] A) {
		int[] counts = new int[3]; // count for color 0,1,2

		System.out.println("Before");
		printIntArray(A);

		for (int i = 0; i < A.length; i++) {
			switch (A[i]) {
			case 0:
				counts[0]++;
				break;
			case 1:
				counts[1]++;
				break;
			case 2:
				counts[2]++;
				break;
			default:
				break;
			}
		}

		// fill in new array
		for (int i = 0; i < A.length; i++) {
			if (i < counts[0]) {
				A[i] = 0;
			} else if (i < counts[1] + counts[0]) {
				A[i] = 1;
			} else {
				A[i] = 2;
			}
		}

		System.out.println("After");
		printIntArray(A);
	}