public static mark dynway( ) //put or pop the books into the basket,mark the highest recorder
{
int Sum,Max;
int lom = -1;
int him = -1;
boolean star = true;
Sum = Max =0;
for(int j = 0;j < array.length;j++)
{
Sum += array[j];
if(Sum > Max){
Max = Sum;
if(star == true){
lom = j;
him = j;
star = false;
}
else{
him = j;
}
}
else if(Sum < 0){
Sum = 0;
star = true;}
}
return new mark(lom,him,Max);
}