Topic: 请问这两种int转16进制方法有什么区别

  Print this page

1.请问这两种int转16进制方法有什么区别 Copy to clipboard
Posted by: woodworm
Posted on: 2003-07-07 09:35

byte[] hash = currentAlgorithm.digest();
String d = "";
for (int i = 0; i < hash.length; i++)
{
int v = hash[i] & 0xFF;
if (v < 16) d += "0";
d += Integer.toString(v, 16).toUpperCase() + " ";//方法一
}

方法二:
Integer.toHexString(v)

请问这两种用法有什么区别


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923