我有一个字节数组,其中包含一个已知的二进制序列。我需要确认二进制序列是否正确。除了 ==
之外,我还试过 .equals
,但都不管用。
byte[] array = new BigInteger("1111000011110001", 2).toByteArray();
if (new BigInteger("1111000011110001", 2).toByteArray() == array){
System.out.println("the same");
} else {
System.out.println("different'");
}