@Test
public void testBigIntegerToBytesSign() {

    {
        BigInteger b = BigInteger.valueOf(-2);
        byte[] actuals = ByteUtil.bigIntegerToBytesSigned(b, 8);
        assertArrayEquals(Hex.decode("fffffffffffffffe"), actuals);
    }
    {
        BigInteger b = BigInteger.valueOf(2);
        byte[] actuals = ByteUtil.bigIntegerToBytesSigned(b, 8);
        assertArrayEquals(Hex.decode("0000000000000002"), actuals);
    }
    {
        BigInteger b = BigInteger.valueOf(0);
        byte[] actuals = ByteUtil.bigIntegerToBytesSigned(b, 8);
        assertArrayEquals(Hex.decode("0000000000000000"), actuals);
    }
    {
        BigInteger b = new BigInteger("eeeeeeeeeeeeee", 16);
        byte[] actuals = ByteUtil.bigIntegerToBytesSigned(b, 8);
        assertArrayEquals(Hex.decode("00eeeeeeeeeeeeee"), actuals);
    }
    {
        BigInteger b = new BigInteger("eeeeeeeeeeeeeeee", 16);
        byte[] actuals = ByteUtil.bigIntegerToBytesSigned(b, 8);
        assertArrayEquals(Hex.decode("eeeeeeeeeeeeeeee"), actuals);
    }
}