DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Java Utility To Translate Integer To Letter-string

09.17.2006
| 880 views |
  • submit to reddit
        // java utility to translate integer to letter-string
package util;

public class LetterUtil {
	
	public static String translate(int i) {
		switch(i) {
			case 9 :  return "TAB";
			case 10 : return "NL";
			case 12 : return "FF";
			case 13 : return "CR";
			case 27 : return "ESC";
			case 32 : return "SP";
			case 33 : return "!";
			case 34 : return "\"";
			case 35 : return "#";
			case 36 : return "$";
			case 37 : return "%";
			case 38 : return "&";
			case 39 : return "'";
			case 40 : return "(";
			case 41 : return ")";
			case 42 : return "*";
			case 43 : return "+";
			case 44 : return ",";
			case 45 : return "-";
			case 46 : return ".";
			case 47 : return "/";
			case 48 : return "0";
			case 49 : return "1";
			case 50 : return "2";
			case 51 : return "3";
			case 52 : return "4";
			case 53 : return "5";
			case 54 : return "6";
			case 55 : return "7";
			case 56 : return "8";
			case 57 : return "9";
			case 58 : return ":";
			case 59 : return ";";
			case 60 : return "<";
			case 61 : return "=";
			case 62 : return ">";
			case 63 : return "?";
			case 64 : return "@";
			case 65 : return "A";
			case 66 : return "B";
			case 67 : return "C";
			case 68 : return "D";
			case 69 : return "E";
			case 70 : return "F";
			case 71 : return "G";
			case 72 : return "H";
			case 73 : return "I";
			case 74 : return "J";
			case 75 : return "K";
			case 76 : return "L";
			case 77 : return "M";
			case 78 : return "N";
			case 79 : return "O";
			case 80 : return "P";
			case 81 : return "Q";
			case 82 : return "R";
			case 83 : return "S";
			case 84 : return "T";
			case 85 : return "U";
			case 86 : return "V";
			case 87 : return "W";
			case 88 : return "X";
			case 89 : return "Y";
			case 90 : return "Z";
			case 91 : return "[";
			case 92 : return "\\";
			case 93 : return "]";
			case 94 : return "^";
			case 95 : return "_";
			case 96 : return "`";
			case 97 : return "a";
			case 98 : return "b";
			case 99 : return "c";
			case 100 : return "d";
			case 101 : return "e";
			case 102 : return "f";
			case 103 : return "g";
			case 104 : return "h";
			case 105 : return "i";
			case 106 : return "j";
			case 107 : return "k";
			case 108 : return "l";
			case 109 : return "m";
			case 110 : return "n";
			case 111 : return "o";
			case 112 : return "p";
			case 113 : return "q";
			case 114 : return "r";
			case 115 : return "s";
			case 116 : return "t";
			case 117 : return "u";
			case 118 : return "v";
			case 119 : return "w";
			case 120 : return "x";
			case 121 : return "y";
			case 122 : return "z";
			case 123 : return "{";
			case 124 : return "|";
			case 125 : return "}";
			case 126 : return "~";
			case 127 : return "";
			case 160 : return " ";
			case 161 : return "¡";
			case 162 : return "¢";
			case 163 : return "£";
			case 164 : return "¤";
			case 165 : return "Â¥";
			case 166 : return "¦";
			case 167 : return "§";
			case 168 : return "¨";
			case 169 : return "©";
			case 170 : return "ª";
			case 171 : return "«";
			case 172 : return "¬";
			case 173 : return "­";
			case 174 : return "®";
			case 175 : return "¯";
			case 176 : return "°";
			case 177 : return "±";
			case 178 : return "²";
			case 179 : return "³";
			case 180 : return "´";
			case 181 : return "µ";
			case 182 : return "¶";
			case 183 : return "·";
			case 184 : return "¸";
			case 185 : return "¹";
			case 186 : return "º";
			case 187 : return "»";
			case 188 : return "¼";
			case 189 : return "½";
			case 190 : return "¾";
			case 191 : return "¿";
			case 192 : return "À";
			case 193 : return "Ã?";
			case 194 : return "Â";
			case 195 : return "Ã";
			case 196 : return "Ä";
			case 197 : return "Ã…";
			case 198 : return "Æ";
			case 199 : return "Ç";
			case 200 : return "È";
			case 201 : return "É";
			case 202 : return "Ê";
			case 203 : return "Ë";
			case 204 : return "Ì";
			case 205 : return "Ã?";
			case 206 : return "ÃŽ";
			case 207 : return "Ã?";
			case 208 : return "Ã?";
			case 209 : return "Ñ";
			case 210 : return "Ã’";
			case 211 : return "Ó";
			case 212 : return "Ô";
			case 213 : return "Õ";
			case 214 : return "Ö";
			case 215 : return "×";
			case 216 : return "Ø";
			case 217 : return "Ù";
			case 218 : return "Ú";
			case 219 : return "Û";
			case 220 : return "Ü";
			case 221 : return "Ã?";
			case 222 : return "Þ";
			case 223 : return "ß";
			case 224 : return "à";
			case 225 : return "á";
			case 226 : return "â";
			case 227 : return "ã";
			case 228 : return "ä";
			case 229 : return "Ã¥";
			case 230 : return "æ";
			case 231 : return "ç";
			case 232 : return "è";
			case 233 : return "é";
			case 234 : return "ê";
			case 235 : return "ë";
			case 236 : return "ì";
			case 237 : return "í";
			case 238 : return "î";
			case 239 : return "ï";
			case 240 : return "ð";
			case 241 : return "ñ";
			case 242 : return "ò";
			case 243 : return "ó";
			case 244 : return "ô";
			case 245 : return "õ";
			case 246 : return "ö";
			case 247 : return "÷";
			case 248 : return "ø";
			case 249 : return "ù";
			case 250 : return "ú";
			case 251 : return "û";
			case 252 : return "ü";
			case 253 : return "ý";
			case 254 : return "þ";
			case 255 : return "ÿ";			
		}
		return "???";
	}	

}