转载请注明出处:http://blog.csdn.net/xiaojimanman/article/details/21458793
本篇博客主要介绍一下如何将16进制的字符串转化为long值,具体代码实现如下:
/**
*@Description:
*/
package cn.lulei.util;
public class Test {
/**
* @param md5L16
* @return
* @Date:2014-3-18
* @Author:lulei
* @Description: 将16位的md5转化为long值
*/
public static long parseMd5L16ToLong(String md5L16){
if (md5L16 == null) {
throw new NumberFormatException("null");
}
md5L16 = md5L16.toLowerCase();
byte[] bA = md5L16.getBytes();
long re = 0L;
for (int i = 0; i < bA.length; i++) {
//加下一位的字符时,先将前面字符计算的结果左移4位
re <<= 4;
//0-9数组
byte b = (byte) (bA[i] - 48);
//A-F字母
if (b > 9) {
b = (byte) (b - 39);
}
//