【发布时间】:2021-02-09 03:54:42
【问题描述】:
String convertByteToBase4(byte x) {
String result = “";
for (int i=0; i<4; i++) {
result = "0123".charAt(x & 3) + result;
x = (byte)(x>>2)
}
return result;
}
我对这段代码中 &3 的用途感到困惑,是否应该将 3 的缩写添加到字节 x 中?
【问题讨论】:
-
不是按位与运算吗?