转换字节数组中的位表示

时间:2014-02-26 13:41:15

标签: java arrays byte bit

我在Java中有一组1和0作为字符串:

String s = "1101111110000000101010110"

如何转换字节数组中一组位的表示?

1 个答案:

答案 0 :(得分:0)

您可以尝试这样:

String s = "1101111110000000101010110";
byte[] b = new BigInteger(s, 2).toByteArray();
相关问题