Java tutorial
//package com.java2s; import android.support.annotation.NonNull; import android.util.Base64; public class Main { @NonNull public static String getBasicAuthorizationHeaderContent(String login, String password) { return "Basic " + Base64.encodeToString((login + ":" + password).getBytes(), Base64.NO_WRAP); } }