Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.apache.commons.codec.binary.Base64;

import java.io.*;

public class Main {
    public static final String UTF_8 = "UTF-8";

    public static String toBase64(final byte[] data) throws UnsupportedEncodingException {
        if (data == null) {
            return null;
        }
        return new String(Base64.encodeBase64(data), UTF_8);
    }
}