I have created access in number format :
1 ( bynary format is - 1 )
2 ( 10 )
4 ( 100 )
8 ( 1000 )
16 ( 10000 )
32 ( 100000 )
64 ( 1000000 )
Then when I want to add access 1, 2, 8 and 32 I do this operation 1 & 2 & 8 & 32
int x = 1 | 2 | 8 | 32; // 43
System.out.println(Integer.toBinaryString(x)); // 101011
How to check that x has '8' access ?