I have the following method:
private static final int OPEN_FOR_RAISE_RANGE = 35;
private static final int OPEN_FOR_CALL_RANGE = 25;
public void foo(double num){
if(num <= OPEN_FOR_RAISE_RANGE){
//do something
}
else if(num <= (OPEN_FOR_RAISE_RANGE + OPEN_FOR_CALL_RANGE)){
//do something else
}
//etc
}
which basically checks what range the number falls in and acts appropriately. I was wondering if there is a nicer/more efficient way to do this other than lots of if’s?
Thanks
Check out NumberRange from commons-lang.