Here you can find the source of base64(final byte[] bytes)
public static String base64(final byte[] bytes)
//package com.java2s; import javax.xml.bind.DatatypeConverter; public class Main { /** Converts the given byte array to a base64 string. */ public static String base64(final byte[] bytes) { return DatatypeConverter.printBase64Binary(bytes); }// w w w .j a v a 2 s . c o m }