public int maxSubArray(int[] A) {

		int max = A[0];
		int runningSum = 0;

		for (int currt : A) {
			runningSum += currt;

			if (runningSum > max) {
				max = runningSum;
			}
			if (runningSum < 0) {
				runningSum = 0;
			}
		}

		return max;
	}