Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use Base64.encode() and Base64.decode() APIs.
package com.bethecoder.tutorials.jodd.encode; import jodd.util.Base64; public class Base64Test { /** * @param args */ public static void main(String[] args) { String str = "BE THE CODER"; String encoded = Base64.encodeToString(str); System.out.println(encoded); String decoded = Base64.decodeToString(encoded); System.out.println(decoded); str = "My test message 123456"; encoded = Base64.encodeToString(str); System.out.println(encoded); decoded = Base64.decodeToString(encoded); System.out.println(decoded); } }
QkUgVEhFIENPREVS BE THE CODER TXkgdGVzdCBtZXNzYWdlIDEyMzQ1Ng== My test message 123456