### Question:
Ecdh { public static byte[] calculateSharedSecret(PublicKey foreignPublicKey, InMemoryPrivateKey privateKey) { Point P = calculateSharedSecretPoint(foreignPublicKey, privateKey); BigInteger Px = P.getX().toBigInteger(); byte[] bytes = EcTools.integerToBytes(Px, SECRET_LENGTH); return HashUtils.sha256(bytes).getBytes(); }  static byte[] calculateSharedSecret(PublicKey foreignPublicKey, InMemoryPrivateKey privateKey); static final int SECRET_LENGTH; }### Answer:
@Test public void sharedSecretTest() { InMemoryPrivateKey myPrv = new InMemoryPrivateKey(PRIVATE_KEY_1, NetworkParameters.productionNetwork); InMemoryPrivateKey foreignPrv = new InMemoryPrivateKey(PRIVATE_KEY_2, NetworkParameters.productionNetwork); byte[] mySecret = Ecdh.calculateSharedSecret(foreignPrv.getPublicKey(), myPrv); byte[] foreignerSecret = Ecdh.calculateSharedSecret(myPrv.getPublicKey(), foreignPrv); assertTrue(BitUtils.areEqual(mySecret, foreignerSecret)); assertEquals(HexUtils.toHex(mySecret), SECRET); }