### Question:
PrivateKey extends Key { public static PrivateKey fromHexString(final String hex) { return new PrivateKey(hex); } PrivateKey(final BigInteger value);  PrivateKey(byte[] bytes);  PrivateKey(String hex); static PrivateKey fromHexString(final String hex); static PrivateKey fromDecimalString(final String decimal); static PrivateKey generateRandom(); static final int SIZE; }### Answer:
@Test public void canCreateFromHexString() { final PrivateKey key = PrivateKey.fromHexString("227F"); MatcherAssert.assertThat(key.getRaw(), IsEqual.equalTo(new BigInteger("227F", 16))); }
@Test public void canCreateFromOddLengthHexString() { final PrivateKey key = PrivateKey.fromHexString("ABC"); MatcherAssert.assertThat( key.getRaw(), IsEqual.equalTo(new BigInteger(new byte[] {(byte) 0x0A, (byte) 0xBC}))); }
@Test public void canCreateFromNegativeHexString() { final PrivateKey key = PrivateKey.fromHexString("8000"); Assertions.assertEquals( "0000000000000000000000000000000000000000000000000000000000008000", key.toHex()); Assertions.assertEquals(BigInteger.valueOf(32768), key.getRaw()); }
@Test public void cannotCreateAroundMalformedHexString() { Assertions.assertThrows( IllegalArgumentException.class, () -> PrivateKey.fromHexString("22G75")); }