Here you can find the source of base64encode(final byte[] data)
public static String base64encode(final byte[] data)
//package com.java2s; //License from project: Apache License import java.util.Base64; public class Main { public static String base64encode(final byte[] data) { final Base64.Encoder encoder = Base64.getEncoder(); return encoder.encodeToString(data); }// w ww .j a va 2 s. c o m public static String base64encode(final String text) { final Base64.Encoder encoder = Base64.getEncoder(); return encoder.encodeToString(text.getBytes()); } }