### Question:
Sign { public static SignatureData signMessage(byte[] message, ECKeyPair keyPair) { BigInteger publicKey = keyPair.getPublicKey(); byte[] messageHash = Hash.sha3(message); ECDSASignature sig = keyPair.sign(messageHash); int recId = -1; for (int i = 0; i < 4; i++) { BigInteger k = recoverFromSignature(i, sig, messageHash); if (k != null && k.equals(publicKey)) { recId = i; break; } } if (recId == -1) { throw new RuntimeException( "Could not construct a recoverable key. This should never happen."); } int headerByte = recId; byte v = (byte) headerByte; byte[] r = Numeric.toBytesPadded(sig.r, 32); byte[] s = Numeric.toBytesPadded(sig.s, 32); return new SignatureData(v, r, s); }  static SignatureData signMessage(byte[] message, ECKeyPair keyPair); static BigInteger signedMessageToKey(
            byte[] message, SignatureData signatureData); static BigInteger publicKeyFromPrivate(BigInteger privKey);  }### Answer:
@Test public void testSignMessage() { Sign.SignatureData signatureData = Sign.signMessage(TEST_MESSAGE, SampleKeys.KEY_PAIR); Sign.SignatureData expected = new Sign.SignatureData( (byte) 0, Numeric.hexStringToByteArray( "0x9631f6d21dec448a213585a4a41a28ef3d4337548aa34734478b563036163786"), Numeric.hexStringToByteArray( "0x2ff816ee6bbb82719e983ecd8a33a4b45d32a4b58377ef1381163d75eedc900b") ); assertThat(signatureData, is(expected)); }