Here you can find the source of getBase64(byte[] bytes)
public static String getBase64(byte[] bytes)
//package com.java2s; //License from project: Open Source License import javax.xml.bind.DatatypeConverter; public class Main { public static String getBase64(byte[] bytes) { String h = DatatypeConverter.printBase64Binary(bytes); h = h.replaceFirst("=*$", ""); h = h.replace('+', '-'); h = h.replace('/', '_'); return h; }/*w w w .j a v a 2 s. c o m*/ }