Bootstrap

最大连续子串和

public int MaxSubArray(int[] array){
     int sum = array[0];
     int temp = array[0];
     int indexFirst = 0;
     int indexLast = 0;
     for(int i=1; i<array.length; i++){
            if(temp < 0){
                  temp = array[i];
                  indexFirst = i;
            }      
            else
                  temp += array[i];
            if(max < temp){
                  max = temp;
                  indexLast = i;
            }
     }
      return max;

}

;