Steven Pongidin Steven Pongidin - 20 days ago 5
Android Question

filtering negative values

How to filter negative values from a set of arrays? I just want to get the positive values, is there any specific class to do it in Java? Is the Math.max in Java is the correct class to do it?

Answer

Is the Math.max in Java is the correct class to do it?

Math is class and Math.max() is static method ,

You just simply need to check each element against the condition

if(number < 0 ){
   //negative
}
Comments