Here you can find the source of encode(final String str)
public static byte[] encode(final String str)
//package com.java2s; //License from project: Apache License import android.util.Base64; public class Main { public static byte[] encode(final String str) { return Base64.encode(str.getBytes(), Base64.DEFAULT); }//from w w w . j a v a 2 s. c om }