c# byte[]转bit
答案:1 悬赏:10
解决时间 2021-01-09 11:03
- 提问者网友:缘字诀
- 2021-01-09 01:49
c# byte[]转bit
最佳答案
- 二级知识专家网友:一把行者刀
- 2021-01-09 03:00
public static bool[] Conve(byte [] byt)
{
int len = byt.Length;
bool [] newBit=new bool[len*4];
int MidByt;
for (int i = 0; i < len; i++)
{
System.Windows.Forms.MessageBox.Show(System.Convert .ToString(byt[i],2));
MidByt = byt[i];
for (int j = 0; j < 4; j++)
{
newBit[i * 4 + j] = System.Convert .ToBoolean(MidByt % 2);
MidByt = MidByt / 2;
System.Windows.Forms.MessageBox.Show(System.Convert.ToString(MidByt, 2) + " " + newBit[i * 4 + j].ToString());
}
}
foreach (bool a in newBit)
{
System.Windows.Forms.MessageBox.Show(a.ToString());
}
return newBit;
}
{
int len = byt.Length;
bool [] newBit=new bool[len*4];
int MidByt;
for (int i = 0; i < len; i++)
{
System.Windows.Forms.MessageBox.Show(System.Convert .ToString(byt[i],2));
MidByt = byt[i];
for (int j = 0; j < 4; j++)
{
newBit[i * 4 + j] = System.Convert .ToBoolean(MidByt % 2);
MidByt = MidByt / 2;
System.Windows.Forms.MessageBox.Show(System.Convert.ToString(MidByt, 2) + " " + newBit[i * 4 + j].ToString());
}
}
foreach (bool a in newBit)
{
System.Windows.Forms.MessageBox.Show(a.ToString());
}
return newBit;
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯