In application frameworks I keep seeing frameworks that allow you to pass in multiple Int values (generally used in place of an enum) into a function.
For example:
public class Example
{
public class Values
{
public static final int ONE = 0x7f020000;
public static final int TWO = 0x7f020001;
public static final int THREE = 0x7f020002;
public static final int FOUR = 0x7f020003;
public static final int FIVE = 0x7f020004;
}
public static void main(String [] args)
{
// should evaluate just Values.ONE
Example.multiValueExample(Values.ONE);
// should evalueate just values Values.ONE, Values.THREE, Values.FIVE
Example.multiValueExample(Values.ONE | Values.THREE | Values.FIVE);
// should evalueate just values Values.TWO , Values.FIVE
Example.multiValueExample(Values.TWO | Values.FIVE);
}
public static void multiValueExample(int values){
// Logic that properly evaluates bitwise values
...
}
}
So what logic should exist in multiValueExample for me to properly evaluate multiple int values being passed in using the bitwise operator?