8位2进制数么?byte num = 127;
byte oneCount = 0;
for( int i = 7; i >= 0; i-- ){
byte temp = (byte)((num >> i) & 0x01);
oneCount += temp;
}
System.out.println(oneCount);
byte oneCount = 0;
for( int i = 7; i >= 0; i-- ){
byte temp = (byte)((num >> i) & 0x01);
oneCount += temp;
}
System.out.println(oneCount);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货