Location:
Search - toHexString
Search list
Description: CRC16算法的Java实现,使用方法如下:
CRC16 crc16 = new CRC16()
byte[] b = new byte[] {
// (byte) 0xF0,(byte)0xF0,(byte)0xF0,(byte)0x72
(byte) 0x2C, (byte) 0x00, (byte) 0xFF, (byte) 0xFE,
(byte) 0xFE, (byte) 0x04, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00 }
for (int k = 0 k < b.length k++) {
crc16.update(b[k])
}
System.out.println(Integer.toHexString(crc16.getValue()))
System.out.println(Integer.toHexString(b.length))
Platform: |
Size: 834 |
Author: zhangQ |
Hits:
Description: CRC16算法的Java实现,使用方法如下:
CRC16 crc16 = new CRC16()
byte[] b = new byte[] {
// (byte) 0xF0,(byte)0xF0,(byte)0xF0,(byte)0x72
(byte) 0x2C, (byte) 0x00, (byte) 0xFF, (byte) 0xFE,
(byte) 0xFE, (byte) 0x04, (byte) 0x00, (byte) 0x00,
(byte) 0x00, (byte) 0x00 }
for (int k = 0 k < b.length k++) {
crc16.update(b[k])
}
System.out.println(Integer.toHexString(crc16.getValue()))
System.out.println(Integer.toHexString(b.length)) -CRC16 algorithm realize Java, use the following method: CRC16 crc16 = new CRC16 () byte [] b = new byte [] (//(byte) 0xF0, (byte) 0xF0, (byte) 0xF0, (byte) 0x72 (byte ) 0x2C, (byte) 0x00, (byte) 0xFF, (byte) 0xFE, (byte) 0xFE, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00) for ( int k = 0 k
Platform: |
Size: 1024 |
Author: zhangQ |
Hits:
Description: 把字符串转换成16进制的字符,可以显示不可显的字符-Convert a string of 16 hexadecimal characters, you can display the characters can not be significantly
Platform: |
Size: 1024 |
Author: yangchangqi |
Hits:
Description: public static String MD5(String inStr) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
return "";
}
char[] charArray = inStr.toCharArray();
byte[] byteArray = new byte[charArray.length];
for (int i = 0; i < charArray.length; i++)
byteArray[i] = (byte) charArray[i];
byte[] md5Bytes = md5.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
for (int i = 0; i < md5Bytes.length; i++) {
int val = ((int) md5Bytes[i]) & 0xff;
if (val < 16)
hexValue.append("0");
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
}
Platform: |
Size: 1024 |
Author: 少郎 |
Hits: