For STEEM, memos are almost always unencrypted, so unless there's an alternative use case, it was more important for me to focus on encrypting/decrypting BitShares memos, which are generally always encrypted.
var encoded = steem.memo.encode(privateWifAccountFrom, publicWifAccountTo, `#This is my private message`);
var decoded = steem.memo.decode(privateWifAccountFromOrTo, encoded);
Regardless, if anyone's come across or managed to tackle this problem and come up with a nice Java solution, please share! I'd be very interested to see it.
Back to BitShares Memos
Given I needed to decrypt BitShares memos anyway, and that solution could be used for any other purpose that would come up as well, I focused my efforts in that direction.
usePrefix parameter allows you to set the public key prefix (ie. 'STM', 'BTS', 'GLS', etc). If you don't require that functionality, you can simply remove that extra code and go with the default used by your toPrivateKey / toPublicKey implementation (such as the one in bitsharesjs).
Here's an example of what the code looks like in action from Chrome Console:
Next, here is the Java implementation of the same functions:
Complete Java class in crypto-playpen: GrapheneMemo.java
asBase64 should be set to false for compatibility, and is meant for other potential use-cases.
In conclusion, for those of you who may have been searching for this solution, I hope this saves you at least a few hours worth of digging, as well as a few potential headaches along the way.
And once again, you can find all this code in my github crypto-playpen repo.