public static String bitsfromByte(byte something)
{
int foo = something & 0xFF;
String out = new String();
for(int si = 0; si < 8; si ++ )
{
if((new BigInteger((foo + " ").trim()).divide(new BigInteger("2").pow(7 - si))).intValue() > 0)
{
foo = (new BigInteger((foo + " ").trim()).subtract(new BigInteger("2").pow(7 - si))).intValue();
out = out + "1";
}
else
{
out = out + "0";
}
}
return out;
}
{
int foo = something & 0xFF;
String out = new String();
for(int si = 0; si < 8; si ++ )
{
if((new BigInteger((foo + " ").trim()).divide(new BigInteger("2").pow(7 - si))).intValue() > 0)
{
foo = (new BigInteger((foo + " ").trim()).subtract(new BigInteger("2").pow(7 - si))).intValue();
out = out + "1";
}
else
{
out = out + "0";
}
}
return out;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货