boolean isNegative=false;
for(int i=0;i<array.length;i++)
{
if(array[i]<0)
{
isNegative=true;
break;
}
}
if(isNegative)
{
// code for displaying negative axis
}
else
{
//only display positive axis
}
solved How to check the positive and negative number’s in a given arraylist in android or java? [closed]