Java tutorial
//package com.java2s; //License from project: Open Source License import org.apache.commons.codec.binary.Base64; public class Main { public static String compressString(String value) { String base64String; byte[] bytes = value.getBytes(); byte[] base64bytes = Base64.encodeBase64(bytes); base64String = new String(base64bytes); return base64String; } }