Java tutorial
//package com.java2s; //License from project: Apache License import android.util.Base64; public class Main { public static String getBasicHeader(String name, String password) { String str = Base64.encodeToString((name + ":" + password).getBytes(), Base64.NO_WRAP); return "Basic " + str; } }