My colleagues and I recently do more investigation, we found the two alternatives for the byte array to string and vice versa:


1. sun.misc.BASE64Decoder and sun.misc.BASE64Encoder. But that was not officially supportted by SUN.

2. MigBase64


Right now the MigBase64 is the fastest solution for this area. And detail bechmarch please check the url:


So here means if you had direction, you could find any fastest solutions for you references.


The results is:


Example StringLength:6291456


HEX encoder  time:421371431 nano seconds

HEX decoder  time:257492503 nano seconds

Encoded StringLength:6291456



sun.misc.BASE64  encode time:258552414 nano seconds

sun.misc.BASE64  decode time:359357404 nano seconds

Encoded StringLength:4304680



MigBASE64 encode  time:49359904 nano seconds

MigBASE64 decode  time:67830130 nano seconds

Encoded StringLength:4304680


So you can see the average time for MigBase64 6 times faster than SunBase64 and 10 times faster than my proposed yesterday.