这是用于改变图像的比特值的功能.是什么|=和 ^=意味着什么呢?
private int setBitValue(int n,int location,int bit) {
int toggle=(int)Math.pow(2,location),bv=getBitValue(n,location);
if(bv==bit)
return n;
if(bv==0 && bit==1)
n|=toggle; // what does it do?
else if(bv==1 && bit==0)
n^=toggle; // what does it do?
return n;
}
Run Code Online (Sandbox Code Playgroud) java ×1