Here you can find the source of encode(String str)
public static String encode(String str)
//package com.java2s; import android.util.Base64; public class Main { public static String encode(String str) { byte[] encode = Base64.encode(str.getBytes(), Base64.DEFAULT); return new String(encode); }/*from w w w . j a v a2s .co m*/ }