shuijian-xu / bitcoin

0 stars 0 forks source link

Java - String whose length are 64 to Biginteger which convert to byte[]; why the length of byte is 33 not 32? #251

Open shuijian-xu opened 4 years ago

shuijian-xu commented 4 years ago

`public static void main(String[] args) { BigInteger b1 = new BigInteger( "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5", 16); BigInteger b2 = new BigInteger( "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", 16);

byte[] b1s = b1.toByteArray();
byte[] b2s = b2.toByteArray();

System.out.println(b1s.length); // the output is 33
System.out.println(b2s.length); // the output is 32

}` Why b1s.length is 33 not 32?