The new permission expression method just hangs out in the forum. I see a post proposing a new permission expression method, which is probably like this:
1. guest
2. web
3. dba
4. boss
For example, if a person is both a dba and a boss, the value calculated based on his or her identity is 23 + 24 = 24. On the contrary, he or she can obtain his or her permissions (the result is unique) based on 24 ), you can use the following program to determine:
/*
* Created on 2005-2-20
* Window-Preferences-Java-Code Style-Code Templates
*/
Package com. tiantian;
/**
* @ Author Administrator
*/
Public class Convert {
Public staticVoidMain (String args []) {
IntNum= 13;
String strBin= Null;
StrBin=Integer. toBinaryString (num );
//System. out. println (strBin );
System. out. print ("Num =");
For(IntI=StrBin. length ()- 1; I> = 0; I--){
CharC=StrBin. charAt (I );
//System. out. println (strBin. charAt (I ));
//System. out. println (I );
If(C= 1){
System. out. print ("2 ^" +(StrBin. length ()- 1 -I)+ "+");
}