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

2019-10-08 09:21:25来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

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

/**
* 转换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;
}

原文链接:https://www.cnblogs.com/zhch1212/p/11629776.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Mybatis映射器接口代理对象的方式 运行过程

下一篇:原创电子书《菜鸟程序员成长之路:从技术小白到阿里巴巴Java工程