code: public String signMessage(String message, @Nullable KeyParameter aesKey) throws KeyCrypterException {
          byte[] data = formatMessageForSigning(message);
          Sha256Hash hash = Sha256Hash.twiceOf(data);
          ECDSASignature sig = sign(hash, aesKey);
          byte recId = findRecoveryId(hash, sig);
          int headerByte = recId + 27 + (isCompressed() ? 4 : 0);
          byte[] sigData = new byte[65];  // 1 header + 32 bytes for R + 32 bytes for S
          sigData[0] = (byte)headerByte;
          System.arraycopy(Utils.bigIntegerToBytes(sig.r, 32), 0, sigData, 1, 32);
          System.arraycopy(Utils.bigIntegerToBytes(sig.s, 32), 0, sigData, 33, 32);
          return new String(Base64.encode(sigData), StandardCharsets.UTF_8);
      }
docs: Signs a text message using the standard Bitcoin messaging signing format and returns the signature as a base64
  encoded string.
  
  @throws IllegalStateException if this ECKey does not have the private part.
  @throws KeyCrypterException if this ECKey is encrypted and no AESKey is provided or it does not decrypt the ECKey.