public int getMaxSubArrayProduct(int[] a) throws IllegalArgumentException {
		
		if (a == null || a.length == 0) { throw new IllegalArgumentException(); }
		
		int _MAX_EndingHere = 1;
		int _MIN_EndingHere = 1;
		int maxSoFar = Integer.MIN_VALUE;
		
		for (int i = 0; i < a.length; i++) {			
			
			/*
			 * If current element is positive, update the maxEndingHere
			 * variable; update minEndingHere only if it is negative
			 */
			if (a[i] > 0) {
				
				_MAX_EndingHere = _MAX_EndingHere * a[i];
				
				_MIN_EndingHere = _MIN_EndingHere * a[i];
				
				if (_MIN_EndingHere < 1) {
					_MIN_EndingHere = 1;
				}
				
			}else {
			
				if (a[i] == 0) {
					
					_MAX_EndingHere = 1;
					_MIN_EndingHere = 1;
					
				}else {
					
					int temp = _MAX_EndingHere;
					_MAX_EndingHere = Math.max(_MIN_EndingHere * a[i], 1);
					_MIN_EndingHere = temp * a[i];
					
				}
			}
			
			maxSoFar = Math.max(maxSoFar, _MAX_EndingHere);
		}
		
		return maxSoFar;
	}