var max=0.0d;
for(inc=0;inc<array.length;inc++){
if(max<array[inc])
max=array[inc];
}
I want to find out the maximum value of an array.The above code is generally we used to find out maximum value of an array.
But this code will return 0
if the array contains only negative
values.
Because 0 < negative
never become true
How to handle this conditions. Please suggest a solution.