private static int maxSum(int[] a){
		int max = Integer.MIN_VALUE;
		int temp=0;
		int m = Integer.MIN_VALUE;
		int linit = 0;
		for(int i=0;i<a.length;i++){
			temp+=a[i];
			m = Math.max(m, a[i]);
			if(temp<0){
				temp=0;
				linit = i+1;
			} else if(temp>max){
				max = temp;
				l = linit;
				r = i;
			}
		}
		if(max==Integer.MIN_VALUE){
			allneg = true;
		}
		return max==Integer.MIN_VALUE?m:max;
	}