I just thought that this is what was really missing here: Some more test cases, to make sure that it really works as expected.
Interestingly enough, the tests for the edge cases reveal how the current solution differs from the original implementation, which is the way how negative as well as very large input resulting in overflow is handled. While the current implementation throws a NumberFormatException in those cases, the original version of the algorithm would not throw at all and instead produce the following results:
You can use reverse method on StringBuffer.
Is there a better way to do it?
What "$" stands for?