<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-101929644234219010</id><updated>2011-10-09T18:36:28.239-07:00</updated><category term='object'/><category term='Rock'/><category term='Decrypt'/><category term='Code'/><category term='Encrypt'/><category term='write file'/><category term='Java'/><title type='text'>Let's code! and Rock the code!</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://coderock.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/101929644234219010/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://coderock.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Fahmi Ramadhan</name><uri>http://www.blogger.com/profile/03285787609439823694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-101929644234219010.post-7054194221445757807</id><published>2011-01-10T09:35:00.000-08:00</published><updated>2011-01-10T09:35:40.551-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='write file'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='object'/><title type='text'>Write object to the file in java</title><content type='html'>When you write a code and it's need to save data result from the code, then you'll need to write it to file. In java, writing the object to file are very easy.. Below are the example in writing it. But first, make a class which implement serializable&lt;br /&gt;&lt;blockquote&gt;&lt;h3&gt;object1.java&lt;/h3&gt;&lt;code&gt;&lt;br /&gt;package utility;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.util.logging.Level;&lt;br /&gt;import java.util.logging.Logger;&lt;br /&gt;public class object1 implements serializable {&lt;br /&gt;    private String attrib1;&lt;br /&gt;    private String attrib2;&lt;br /&gt;    private String attrib3;&lt;br /&gt;    private String attrib4;&lt;br /&gt;&lt;br /&gt;    public object1(){&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //create setter and getter&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/blockquote&gt;after that, then set the value for each attribut in object 1, then call the method in this export class&lt;br /&gt;&lt;blockquote&gt;&lt;h3&gt;export.java&lt;/h3&gt;&lt;code&gt;&lt;br /&gt;/*&lt;br /&gt; * To change this template, choose Tools | Templates&lt;br /&gt; * and open the template in the editor.&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;package utility;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.util.logging.Level;&lt;br /&gt;import java.util.logging.Logger;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author Fahmi_rnf&lt;br /&gt; */&lt;br /&gt;public class exportData implements Serializable{&lt;br /&gt;    public exportData(){&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public exportData(Object exp,String fileName) throws IOException{&lt;br /&gt;        FileOutputStream f;&lt;br /&gt;        try {&lt;br /&gt;            f = new FileOutputStream(fileName);&lt;br /&gt;            ObjectOutputStream s = new ObjectOutputStream(f);         &lt;br /&gt;            &lt;br /&gt;            s.writeObject(exp);&lt;br /&gt;            s.flush();&lt;br /&gt;        } catch (FileNotFoundException ex) {&lt;br /&gt;            Logger.getLogger(exportData.class.getName()).log(Level.SEVERE, null, ex);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/101929644234219010-7054194221445757807?l=coderock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coderock.blogspot.com/feeds/7054194221445757807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coderock.blogspot.com/2011/01/write-object-to-file-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/101929644234219010/posts/default/7054194221445757807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/101929644234219010/posts/default/7054194221445757807'/><link rel='alternate' type='text/html' href='http://coderock.blogspot.com/2011/01/write-object-to-file-in-java.html' title='Write object to the file in java'/><author><name>Fahmi Ramadhan</name><uri>http://www.blogger.com/profile/03285787609439823694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-101929644234219010.post-997224915724850420</id><published>2011-01-10T08:21:00.000-08:00</published><updated>2011-01-10T08:21:27.749-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='Decrypt'/><category scheme='http://www.blogger.com/atom/ns#' term='Encrypt'/><title type='text'>Encrypt and Decrypt in Java</title><content type='html'>Encrypt and Decrypt are some functional for use in order to secure data or document. In Java, encrypt and decrypt are easy to use and understand because Java has library to do this. We just call what we need and add something ROCK to the code, then boom.. the code is ready to serve..&lt;br /&gt;Here are example for encrypt and decrypt in Java using some algorithm.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;/*&lt;br /&gt; * To change this template, choose Tools | Templates&lt;br /&gt; * and open the template in the editor.&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;package utility;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; *&lt;br /&gt; * @author fahmi_rnf&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;// -----------------------------------------------------------------------------&lt;br /&gt;// StringEncrypter.java&lt;br /&gt;// -----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt; * =============================================================================&lt;br /&gt; * Copyright (c) 1998-2005 Jeffrey M. Hunter. All rights reserved.&lt;br /&gt; *&lt;br /&gt; * All source code and material located at the Internet address of&lt;br /&gt; * http://www.idevelopment.info is the copyright of Jeffrey M. Hunter, 2005 and&lt;br /&gt; * is protected under copyright laws of the United States. This source code may&lt;br /&gt; * not be hosted on any other site without my express, prior, written&lt;br /&gt; * permission. Application to host any of the material elsewhere can be made by&lt;br /&gt; * contacting me at jhunter@idevelopment.info.&lt;br /&gt; *&lt;br /&gt; * I have made every effort and taken great care in making sure that the source&lt;br /&gt; * code and other content included on my web site is technically accurate, but I&lt;br /&gt; * disclaim any and all responsibility for any loss, damage or destruction of&lt;br /&gt; * data or any other property which may arise from relying on it. I will in no&lt;br /&gt; * case be liable for any monetary damages arising from such loss, damage or&lt;br /&gt; * destruction.&lt;br /&gt; *&lt;br /&gt; * As with any code, ensure to test this code in a development environment&lt;br /&gt; * before attempting to run it in production.&lt;br /&gt; * =============================================================================&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;// CIPHER / GENERATORS&lt;br /&gt;import javax.crypto.Cipher;&lt;br /&gt;import javax.crypto.SecretKey;&lt;br /&gt;import javax.crypto.KeyGenerator;&lt;br /&gt;&lt;br /&gt;// KEY SPECIFICATIONS&lt;br /&gt;import java.security.spec.KeySpec;&lt;br /&gt;import java.security.spec.AlgorithmParameterSpec;&lt;br /&gt;import javax.crypto.spec.PBEKeySpec;&lt;br /&gt;import javax.crypto.SecretKeyFactory;&lt;br /&gt;import javax.crypto.spec.PBEParameterSpec;&lt;br /&gt;&lt;br /&gt;// EXCEPTIONS&lt;br /&gt;import java.security.InvalidAlgorithmParameterException;&lt;br /&gt;import java.security.NoSuchAlgorithmException;&lt;br /&gt;import java.security.InvalidKeyException;&lt;br /&gt;import java.security.spec.InvalidKeySpecException;&lt;br /&gt;import javax.crypto.NoSuchPaddingException;&lt;br /&gt;import javax.crypto.BadPaddingException;&lt;br /&gt;import javax.crypto.IllegalBlockSizeException;&lt;br /&gt;import java.io.UnsupportedEncodingException;&lt;br /&gt;import java.io.IOException;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * -----------------------------------------------------------------------------&lt;br /&gt; * The following example implements a class for encrypting and decrypting&lt;br /&gt; * strings using several Cipher algorithms. The class is created with a key and&lt;br /&gt; * can be used repeatedly to encrypt and decrypt strings using that key.&lt;br /&gt; * Some of the more popular algorithms are:&lt;br /&gt; *      Blowfish&lt;br /&gt; *      DES&lt;br /&gt; *      DESede&lt;br /&gt; *      PBEWithMD5AndDES&lt;br /&gt; *      PBEWithMD5AndTripleDES&lt;br /&gt; *      TripleDES&lt;br /&gt; *&lt;br /&gt; * @version 1.0&lt;br /&gt; * @author  Jeffrey M. Hunter  (jhunter@idevelopment.info)&lt;br /&gt; * @author  http://www.idevelopment.info&lt;br /&gt; * -----------------------------------------------------------------------------&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;public class StringEncrypter {&lt;br /&gt;&lt;br /&gt;    Cipher ecipher;&lt;br /&gt;    Cipher dcipher;&lt;br /&gt;&lt;br /&gt;    String desEncrypted;&lt;br /&gt;    String desDecrypted;&lt;br /&gt;    public StringEncrypter() {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Constructor used to create this object.  Responsible for setting&lt;br /&gt;     * and initializing this object's encrypter and decrypter Chipher instances&lt;br /&gt;     * given a Secret Key and algorithm.&lt;br /&gt;     * @param key        Secret Key used to initialize both the encrypter and&lt;br /&gt;     *                   decrypter instances.&lt;br /&gt;     * @param algorithm  Which algorithm to use for creating the encrypter and&lt;br /&gt;     *                   decrypter instances.&lt;br /&gt;     */&lt;br /&gt;&lt;br /&gt;    StringEncrypter(SecretKey key, String algorithm) {&lt;br /&gt;        try {&lt;br /&gt;            ecipher = Cipher.getInstance(algorithm);&lt;br /&gt;            dcipher = Cipher.getInstance(algorithm);&lt;br /&gt;            ecipher.init(Cipher.ENCRYPT_MODE, key);&lt;br /&gt;            dcipher.init(Cipher.DECRYPT_MODE, key);&lt;br /&gt;        } catch (NoSuchPaddingException e) {&lt;br /&gt;            System.out.println("EXCEPTION: NoSuchPaddingException");&lt;br /&gt;        } catch (NoSuchAlgorithmException e) {&lt;br /&gt;            System.out.println("EXCEPTION: NoSuchAlgorithmException");&lt;br /&gt;        } catch (InvalidKeyException e) {&lt;br /&gt;            System.out.println("EXCEPTION: InvalidKeyException");&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Constructor used to create this object.  Responsible for setting&lt;br /&gt;     * and initializing this object's encrypter and decrypter Chipher instances&lt;br /&gt;     * given a Pass Phrase and algorithm.&lt;br /&gt;     * @param passPhrase Pass Phrase used to initialize both the encrypter and&lt;br /&gt;     *                   decrypter instances.&lt;br /&gt;     */&lt;br /&gt;    public StringEncrypter(String passPhrase) {&lt;br /&gt;&lt;br /&gt;        // 8-bytes Salt&lt;br /&gt;        byte[] salt = {&lt;br /&gt;            (byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,&lt;br /&gt;            (byte)0x56, (byte)0x34, (byte)0xE3, (byte)0x03&lt;br /&gt;        };&lt;br /&gt;&lt;br /&gt;        // Iteration count&lt;br /&gt;        int iterationCount = 19;&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;&lt;br /&gt;            KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);&lt;br /&gt;            SecretKey key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);&lt;br /&gt;&lt;br /&gt;            ecipher = Cipher.getInstance(key.getAlgorithm());&lt;br /&gt;            dcipher = Cipher.getInstance(key.getAlgorithm());&lt;br /&gt;&lt;br /&gt;            // Prepare the parameters to the cipthers&lt;br /&gt;            AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);&lt;br /&gt;&lt;br /&gt;            ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);&lt;br /&gt;            dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);&lt;br /&gt;&lt;br /&gt;        } catch (InvalidAlgorithmParameterException e) {&lt;br /&gt;            System.out.println("EXCEPTION: InvalidAlgorithmParameterException");&lt;br /&gt;        } catch (InvalidKeySpecException e) {&lt;br /&gt;            System.out.println("EXCEPTION: InvalidKeySpecException");&lt;br /&gt;        } catch (NoSuchPaddingException e) {&lt;br /&gt;            System.out.println("EXCEPTION: NoSuchPaddingException");&lt;br /&gt;        } catch (NoSuchAlgorithmException e) {&lt;br /&gt;            System.out.println("EXCEPTION: NoSuchAlgorithmException");&lt;br /&gt;        } catch (InvalidKeyException e) {&lt;br /&gt;            System.out.println("EXCEPTION: InvalidKeyException");&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Takes a single String as an argument and returns an Encrypted version&lt;br /&gt;     * of that String.&lt;br /&gt;     * @param str String to be encrypted&lt;br /&gt;     * @return &lt;code&gt;String&lt;/code&gt; Encrypted version of the provided String&lt;br /&gt;     */&lt;br /&gt;    public String encrypt(String str) {&lt;br /&gt;        try {&lt;br /&gt;            // Encode the string into bytes using utf-8&lt;br /&gt;            byte[] utf8 = str.getBytes("UTF8");&lt;br /&gt;&lt;br /&gt;            // Encrypt&lt;br /&gt;            byte[] enc = ecipher.doFinal(utf8);&lt;br /&gt;&lt;br /&gt;            // Encode bytes to base64 to get a string&lt;br /&gt;            return new sun.misc.BASE64Encoder().encode(enc);&lt;br /&gt;&lt;br /&gt;        } catch (BadPaddingException e) {&lt;br /&gt;        } catch (IllegalBlockSizeException e) {&lt;br /&gt;        } catch (UnsupportedEncodingException e) {&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;        }&lt;br /&gt;        return null;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Takes a encrypted String as an argument, decrypts and returns the&lt;br /&gt;     * decrypted String.&lt;br /&gt;     * @param str Encrypted String to be decrypted&lt;br /&gt;     * @return &lt;code&gt;String&lt;/code&gt; Decrypted version of the provided String&lt;br /&gt;     */&lt;br /&gt;    public String decrypt(String str) {&lt;br /&gt;&lt;br /&gt;        try {&lt;br /&gt;&lt;br /&gt;            // Decode base64 to get bytes&lt;br /&gt;            byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);&lt;br /&gt;&lt;br /&gt;            // Decrypt&lt;br /&gt;            byte[] utf8 = dcipher.doFinal(dec);&lt;br /&gt;&lt;br /&gt;            // Decode using utf-8&lt;br /&gt;            return new String(utf8, "UTF8");&lt;br /&gt;&lt;br /&gt;        } catch (BadPaddingException e) {&lt;br /&gt;        } catch (IllegalBlockSizeException e) {&lt;br /&gt;        } catch (UnsupportedEncodingException e) {&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;        }&lt;br /&gt;        return null;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * The following method is used for testing the String Encrypter class.&lt;br /&gt;     * This method is responsible for encrypting and decrypting a sample&lt;br /&gt;     * String using several symmetric temporary Secret Keys.&lt;br /&gt;     */&lt;br /&gt;    public static void testUsingSecretKey() {&lt;br /&gt;        try {&lt;br /&gt;&lt;br /&gt;            System.out.println();&lt;br /&gt;            System.out.println("+----------------------------------------+");&lt;br /&gt;            System.out.println("|  -- Test Using Secret Key Method --    |");&lt;br /&gt;            System.out.println("+----------------------------------------+");&lt;br /&gt;            System.out.println();&lt;br /&gt;&lt;br /&gt;            String secretString = "Code Rock";&lt;br /&gt;&lt;br /&gt;            // Generate a temporary key for this example. In practice, you would&lt;br /&gt;            // save this key somewhere. Keep in mind that you can also use a&lt;br /&gt;            // Pass Phrase.&lt;br /&gt;            SecretKey desKey       = KeyGenerator.getInstance("DES").generateKey();&lt;br /&gt;            SecretKey blowfishKey  = KeyGenerator.getInstance("Blowfish").generateKey();&lt;br /&gt;            SecretKey desedeKey    = KeyGenerator.getInstance("DESede").generateKey();&lt;br /&gt;&lt;br /&gt;            // Create encrypter/decrypter class&lt;br /&gt;            StringEncrypter desEncrypter = new StringEncrypter(desKey, desKey.getAlgorithm());&lt;br /&gt;            StringEncrypter blowfishEncrypter = new StringEncrypter(blowfishKey, blowfishKey.getAlgorithm());&lt;br /&gt;            StringEncrypter desedeEncrypter = new StringEncrypter(desedeKey, desedeKey.getAlgorithm());&lt;br /&gt;&lt;br /&gt;            // Encrypt the string&lt;br /&gt;            String desEncrypted       = desEncrypter.encrypt(secretString);&lt;br /&gt;            String blowfishEncrypted  = blowfishEncrypter.encrypt(secretString);&lt;br /&gt;            String desedeEncrypted    = desedeEncrypter.encrypt(secretString);&lt;br /&gt;&lt;br /&gt;            // Decrypt the string&lt;br /&gt;            String desDecrypted       = desEncrypter.decrypt(desEncrypted);&lt;br /&gt;            String blowfishDecrypted  = blowfishEncrypter.decrypt(blowfishEncrypted);&lt;br /&gt;            String desedeDecrypted    = desedeEncrypter.decrypt(desedeEncrypted);&lt;br /&gt;&lt;br /&gt;            // Print out values&lt;br /&gt;            System.out.println(desKey.getAlgorithm() + " Encryption algorithm");&lt;br /&gt;            System.out.println("    Original String  : " + secretString);&lt;br /&gt;            System.out.println("    Encrypted String : " + desEncrypted);&lt;br /&gt;            System.out.println("    Decrypted String : " + desDecrypted);&lt;br /&gt;            System.out.println();&lt;br /&gt;&lt;br /&gt;            System.out.println(blowfishKey.getAlgorithm() + " Encryption algorithm");&lt;br /&gt;            System.out.println("    Original String  : " + secretString);&lt;br /&gt;            System.out.println("    Encrypted String : " + blowfishEncrypted);&lt;br /&gt;            System.out.println("    Decrypted String : " + blowfishDecrypted);&lt;br /&gt;            System.out.println();&lt;br /&gt;&lt;br /&gt;            System.out.println(desedeKey.getAlgorithm() + " Encryption algorithm");&lt;br /&gt;            System.out.println("    Original String  : " + secretString);&lt;br /&gt;            System.out.println("    Encrypted String : " + desedeEncrypted);&lt;br /&gt;            System.out.println("    Decrypted String : " + desedeDecrypted);&lt;br /&gt;            System.out.println();&lt;br /&gt;&lt;br /&gt;        } catch (NoSuchAlgorithmException e) {&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * The following method is used for testing the String Encrypter class.&lt;br /&gt;     * This method is responsible for encrypting and decrypting a sample&lt;br /&gt;     * String using using a Pass Phrase.&lt;br /&gt;     */&lt;br /&gt;    public void testUsingPassPhrase(String a,String b) {&lt;br /&gt;&lt;br /&gt;        System.out.println();&lt;br /&gt;        System.out.println("+----------------------------------------+");&lt;br /&gt;        System.out.println("|  -- Test Using Pass Phrase Method --   |");&lt;br /&gt;        System.out.println("+----------------------------------------+");&lt;br /&gt;        System.out.println();&lt;br /&gt;&lt;br /&gt;        String secretString = a;&lt;br /&gt;        String passPhrase   = b;&lt;br /&gt;&lt;br /&gt;        // Create encrypter/decrypter class&lt;br /&gt;        StringEncrypter desEncrypter = new StringEncrypter(passPhrase);&lt;br /&gt;&lt;br /&gt;        // Encrypt the string&lt;br /&gt;        desEncrypted       = desEncrypter.encrypt(secretString);&lt;br /&gt;&lt;br /&gt;        // Decrypt the string&lt;br /&gt;&lt;br /&gt;        desDecrypted       = desEncrypter.decrypt(desEncrypted);&lt;br /&gt;&lt;br /&gt;        // Print out values&lt;br /&gt;        System.out.println("PBEWithMD5AndDES Encryption algorithm");&lt;br /&gt;        System.out.println("    Original String  : " + secretString);&lt;br /&gt;        System.out.println("    Encrypted String : " + desEncrypted);&lt;br /&gt;        System.out.println("    Decrypted String : " + desDecrypted);&lt;br /&gt;        System.out.println();&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Sole entry point to the class and application used for testing the&lt;br /&gt;     * String Encrypter class.&lt;br /&gt;     * @param args Array of String arguments.&lt;br /&gt;     */&lt;br /&gt;    public static void main(String[] args) {&lt;br /&gt;        testUsingSecretKey();&lt;br /&gt;        //testUsingPassPhrase("code","rock");&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String getDesDecrypted() {&lt;br /&gt;        return desDecrypted;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setDesDecrypted(String desDecrypted) {&lt;br /&gt;        this.desDecrypted = desDecrypted;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public String getDesEncrypted() {&lt;br /&gt;        return desEncrypted;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void setDesEncrypted(String desEncrypted) {&lt;br /&gt;        this.desEncrypted = desEncrypted;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;Just copy Paste and Run the code, you'll see the ROCK!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/101929644234219010-997224915724850420?l=coderock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coderock.blogspot.com/feeds/997224915724850420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coderock.blogspot.com/2011/01/encrypt-and-decrypt-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/101929644234219010/posts/default/997224915724850420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/101929644234219010/posts/default/997224915724850420'/><link rel='alternate' type='text/html' href='http://coderock.blogspot.com/2011/01/encrypt-and-decrypt-in-java.html' title='Encrypt and Decrypt in Java'/><author><name>Fahmi Ramadhan</name><uri>http://www.blogger.com/profile/03285787609439823694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-101929644234219010.post-1640625890399640151</id><published>2011-01-10T07:50:00.000-08:00</published><updated>2011-01-10T07:50:38.289-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rock'/><category scheme='http://www.blogger.com/atom/ns#' term='Code'/><title type='text'>Let's code! code and rock!</title><content type='html'>Welcome to CODEROCK! you can learn and get any codes from this. But before we get started, let's play Rock Music. Avenged Sevenfold, MCR, or anything else, because rock music help us write the rock code. Let's code and ROOOCK!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/101929644234219010-1640625890399640151?l=coderock.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://coderock.blogspot.com/feeds/1640625890399640151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://coderock.blogspot.com/2011/01/lets-code-code-and-rock.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/101929644234219010/posts/default/1640625890399640151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/101929644234219010/posts/default/1640625890399640151'/><link rel='alternate' type='text/html' href='http://coderock.blogspot.com/2011/01/lets-code-code-and-rock.html' title='Let&apos;s code! code and rock!'/><author><name>Fahmi Ramadhan</name><uri>http://www.blogger.com/profile/03285787609439823694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
