Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static String Encrypt(String toEncrypt, String key) { char[] chars = toEncrypt.toCharArray(); char[] newChars = new char[chars.length]; for (int i = 0; i < chars.length; i++) { if (chars[i] > 31 && chars[i] < 240) { newChars[i] = key.charAt((int) chars[i] - 32); } else { newChars[i] = chars[i]; } } return new String(newChars); } }