Java tutorial
//package com.java2s; import java.io.UnsupportedEncodingException; import android.util.Base64; public class Main { public static String base64Encode(byte[] in) { String encoded = null; try { encoded = new String(Base64.encode(in, Base64.URL_SAFE | Base64.NO_PADDING), "UTF8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return encoded; } }