library : commons-codec-1.8 https://www.dropbox.com/sh/qvoml3a8u34rl9x/LNFJFiWJky
atau : https://www.dropbox.com/sh/qvoml3a8u34rl9x/LNFJFiWJky
/*
* Author : Fandy Adam
* Email : casperadam91@gmail.com
* netbeans 7.3.x JDK 1.7
*/
package encryptde;
import org.apache.commons.codec.binary.Base64;
/**
*
* @author casper
*/
public class EncryptDe {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String orig = "java2s";
//encoding byte array into base 64
byte[] encoded = Base64.encodeBase64(orig.getBytes());
System.out.println("Original String: " + orig );
System.out.println("Base64 Encoded String : " + new String(encoded));
//decoding byte array into base64
byte[] decoded = Base64.decodeBase64(encoded);
System.out.println("Base 64 Decoded String : " + new String(decoded));
}
}
Subscribe to:
Post Comments (Atom)






0 comments:
Post a Comment