欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

转换byte(十进制)为图形(大小写字母,符号)

程序员文章站 2022-04-17 22:05:25
/** * 转换byte(十进制)为字母 */ public static String ByteToLetter (byte[] chars) { String Letter = ""; for (int i = 0; i < chars.length; i++) { switch (chars[ ......
/**
* 转换byte(十进制)为字母
*/
public static string bytetoletter (byte[] chars) {
string letter = "";
for (int i = 0; i < chars.length; i++) {
switch (chars[i]) {
case 45:
letter += "-";
break;
case 46:
letter += ".";
break;
case 47:
letter += "/";
break;
case 48:
letter += "0";
break;
case 49:
letter += "1";
break;
case 50:
letter += "2";
break;
case 51:
letter += "3";
break;
case 52:
letter += "4";
break;
case 53:
letter += "5";
break;
case 54:
letter += "6";
break;
case 55:
letter += "7";
break;
case 56:
letter += "8";
break;
case 57:
letter += "9";
break;
case 65:
letter += "a";
break;
case 66:
letter += "b";
break;
case 67:
letter += "c";
break;
case 68:
letter += "d";
break;
case 69:
letter += "e";
break;
case 70:
letter += "f";
break;
case 71:
letter += "g";
break;
case 72:
letter += "h";
break;
case 73:
letter += "i";
break;
case 74:
letter += "j";
break;
case 75:
letter += "k";
break;
case 76:
letter += "l";
break;
case 77:
letter += "m";
break;
case 78:
letter += "n";
break;
case 79:
letter += "o";
break;
case 80:
letter += "p";
break;
case 81:
letter += "q";
break;
case 82:
letter += "r";
break;
case 83:
letter += "s";
break;
case 84:
letter += "t";
break;
case 85:
letter += "u";
break;
case 86:
letter += "v";
break;
case 87:
letter += "w";
break;
case 88:
letter += "x";
break;
case 89:
letter += "y";
break;
case 90:
letter += "z";
break;
case 95:
letter += "a";
break;
case 98:
letter += "b";
break;
case 99:
letter += "c";
break;
case 100:
letter += "d";
break;
case 101:
letter += "e";
break;
case 102:
letter += "f";
break;
case 103:
letter += "g";
break;
case 104:
letter += "h";
break;
case 105:
letter += "i";
break;
case 106:
letter += "j";
break;
case 107:
letter += "k";
break;
case 108:
letter += "l";
break;
case 109:
letter += "m";
break;
case 110:
letter += "n";
break;
case 111:
letter += "o";
break;
case 112:
letter += "p";
break;
case 113:
letter += "q";
break;
case 114:
letter += "r";
break;
case 115:
letter += "s";
break;
case 116:
letter += "t";
break;
case 117:
letter += "u";
break;
case 118:
letter += "v";
break;
case 119:
letter += "w";
break;
case 120:
letter += "x";
break;
case 121:
letter += "y";
break;
case 122:
letter += "z";
break;
default:
letter += "";
}
}
return letter;
}