admin 管理员组

文章数量: 1184232


2024年4月17日发(作者:英语在线教学)

string转换为16进制形式

* @param s

* @return

*/

private static String str2HexStr(String s) {

String str = "";

for (int i = 0; i < (); i++) {

int ch = (int) (i);

String s4 = tring(ch).toUpperCase();

str = str + s4;

}

return str;

}

/**

* 16进制转换为string

* @param s

* @return

*/

private static String hexStr2Str(String s) {

if (s == null || ("")) {

return null;

}

s = e(" ", "");

byte[] baKeyword = new byte[() / 2];

for (int i = 0; i < ; i++) {

try {

baKeyword[i] = (byte) (0xff & nt(

ing(i * 2, i * 2 + 2), 16));

} catch (Exception e) {

tackTrace();

}

}

try {

s = new String(baKeyword, "ASCII");

new String();

} catch (Exception e1) {

tackTrace();

}

return s;

}

/**


本文标签: 进制 转换 教学