### Question:
EthereumSign { public static String personalSign(String data, byte[] prvKeyBytes) { byte[] dataBytes = dataToBytes(data); int msgLen = dataBytes.length; String headerMsg = String.format(Locale.ENGLISH, "\u0019Ethereum Signed Message:\n%d", msgLen); byte[] headerMsgBytes = headerMsg.getBytes(Charset.forName("UTF-8")); byte[] dataToSign = ByteUtil.concat(headerMsgBytes, dataBytes); return signMessage(dataToSign, prvKeyBytes).toString(); }  static String personalSign(String data, byte[] prvKeyBytes); static String sign(String data, byte[] prvKeyBytes); static BigInteger ecRecover(String data, String signature); static String recoverAddress(String data, String signature); static SignatureData signAsRecoverable(byte[] value, ECKey ecKey);  }### Answer:
@Test public void testPersonalSign() { Object[][] testcases = new Object[][] { new Object[] { "Hello imToken", "1be38ff0ab0e6d97cba73cf61421f0641628be8ee91dcb2f73315e7fdf4d0e2770b0cb3cc7350426798d43f0fb05602664a28bb2c9fcf46a07fa1c8c4e322ec01b"}, new Object[] { SampleKey.ADDRESS, "b12a1c9d3a7bb722d952366b06bd48cb35bdf69065dee92351504c3716a782493c697de7b5e59579bdcc624aa277f8be5e7f42dc65fe7fcd4cc68fef29ff28c21b" } }; for (Object[] aCase : testcases) { String actual = EthereumSign.personalSign((String)aCase[0], NumericUtil.hexToBytes(SampleKey.PRIVATE_KEY_STRING)); Assert.assertEquals(aCase[1], actual); } }