public Triplet kadane(int arr[]){
        int sum =0;
        int cStart = 0;
        int mStart = 0;
        int end = 0;
        int maxSum = Integer.MIN_VALUE;
        for(int i=0; i < arr.length; i++){
            sum += arr[i];
            if(sum <= 0){
                sum = 0;
                cStart = i+1;
            }else{
                if(sum > maxSum){
                    maxSum = sum;
                    mStart = cStart;
                    end = i;
                }
            }
        }
        Triplet p = new Triplet();
        p.sum = maxSum;
        p.start = mStart;
        p.end = end;
        return p;
    }
This method assumes there is at least one positive number in the array.
Otherwise it will break
@param arr
@return
src/com/interview/array/KadaneWrapArray.java