/****************************************
 * \n 을 <br>로 바꾼다.
 * @param String
 * @return String 치환된 문자열
*****************************************/
    public static String repl(String text) {
     if( text == null || text.equals("") ) return "";
    
     StringBuffer sb = new StringBuffer(text);
     char ch;
    
     for (int i = 0; i < sb.length(); i++) {
     ch = sb.charAt(i);
    
     if (ch == '\r' && sb.charAt(i+1) == '\n' ) {
     sb.replace(i,i+2,"<br>");
                i += 3;
     }
     }
    
        return sb.toString();
    }

AND

/**
     * 특수문자를 변환한다.
     * @param String
     */
    public static String convertInputValue(String message){
        message = message.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;")
        .replace("'", "&apos;").replace("\\", "&#x2F;").replace(" ", "&nbsp;").replace("\n", "<br />");
        
        return message;
    }
    

AND

import java.security.Key;
import java.security.NoSuchAlgorithmException;
 
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;

public class DES3Util {
private static Key key = null;
    
    static {
     if(key == null) {
      // Key 초기화
     KeyGenerator keyGenerator;
      try {
       keyGenerator = KeyGenerator.getInstance("TripleDES");
       keyGenerator.init(168);
       key = keyGenerator.generateKey();
      } catch (NoSuchAlgorithmException e) {
       e.printStackTrace();
      }
     }
    }
     
    public static String encrypt(String inStr) {
     StringBuffer sb = null;
     try {
      Cipher cipher = Cipher.getInstance("TripleDES/ECB/PKCS5Padding");
      cipher.init(Cipher.ENCRYPT_MODE, key);
      byte[] plaintext = inStr.getBytes("UTF8");
      byte[] ciphertext = cipher.doFinal(plaintext);
       
      sb = new StringBuffer(ciphertext.length * 2);
      for(int i = 0; i < ciphertext.length; i++) {
       String hex = "0" + Integer.toHexString(0xff & ciphertext[i]);
       sb.append(hex.substring(hex.length()-2));
      }
     }catch(Exception e) {
      e.printStackTrace();
     }
     return sb.toString();
    }
     
    public static String decrypt(String inStr) {
     String text = null;
     try {
      byte[] b = new byte[inStr.length()/2];
      Cipher cipher = Cipher.getInstance("TripleDES/ECB/PKCS5Padding");
      cipher.init(Cipher.DECRYPT_MODE, key);
      for(int i = 0; i < b.length; i++) {
       b[i] = (byte)Integer.parseInt(inStr.substring(2*i, 2*i+2), 16);
      }
      byte[] decryptedText = cipher.doFinal(b);
      text = new String(decryptedText,"UTF8");
     }catch(Exception e) {
      e.printStackTrace();
     }
     return text;
    }
}

AND