Encode using apache codec Base64 - Java Security

Java examples for Security:MD5

Description

Encode using apache codec Base64

Demo Code

import org.apache.commons.codec.binary.Base64;

public class encode{

    public static void main(String args[]) throws IOException {
        String orig = "core";
        byte[] encoded = Base64.encodeBase64(orig.getBytes());     
       System.out.println("Original String: " + orig );
        System.out.println("Base64 Encoded String : " + new String(encoded));
        }/*w  w  w.  j  a v a  2  s  . c o m*/
}

Related Tutorials