byteArr转hexString
<p>例如：</p>
bytes2HexString(new byte[] { 0, (byte) 0xa8 }) returns 00A8

@param bytes 字节数组
@return 16进制大写字符串
970365
public static String bytes2HexString(byte[] bytes) {
        if (bytes == null) return null;
        int len = bytes.length;
        if (len <= 0) return null;
        char[] ret = new char[len << 1];
        for (int i = 0, j = 0; i < len; i++) {
            ret[j++] = HEX_DIGITS[bytes[i] >>> 4 & 0x0f];
            ret[j++] = HEX_DIGITS[bytes[i] & 0x0f];
        }
        return new String(ret).toLowerCase();
    }
666007
public static String toBinaryString(byte[] bytes) {
        StringBuilder buffer = new StringBuilder();
        for(byte b: bytes) {
            String bin = Integer.toBinaryString(0xFF & b);
            bin = bin.substring(0, Math.min(bin.length(), 8));

            for(int j = 0; j < 8 - bin.length(); j++) {
                buffer.append('0');
            }

            buffer.append(bin);
        }
        return buffer.toString();
    }
194299
public static String toHexString(byte b) {
    StringBuffer sb = new StringBuffer(4);
    sb.append("0x").append(HEX_CHARS[0x0F & (b >> 4)])
        .append(HEX_CHARS[b & 0x0F]);
    return sb.toString();
  }
826844
public static String hex(byte[] bytes) {
        char[] hexChars = new char[bytes.length * 2];
        for (int j = 0; j < bytes.length; j++) {
            int v = bytes[j] & 0xFF;
            hexChars[j * 2] = HEXES_SMALL[v >>> 4];
            hexChars[j * 2 + 1] = HEXES_SMALL[v & 0x0F];
        }
        return new String(hexChars);
    }
1044489
public static String byteToHex(byte b[]) {

        int    len = b.length;
        char[] s   = new char[len * 2];

        for (int i = 0, j = 0; i < len; i++) {
            int c = ((int) b[i]) & 0xff;

            s[j++] = HEXCHAR[c >> 4 & 0xf];
            s[j++] = HEXCHAR[c & 0xf];
        }

        return new String(s);
    }
944402
public static String byte2Hex(int value) {
    if (value > 255 || value < 0) {
      throw new IllegalArgumentException("The int converting to hex should be in range 0~255");
    }
    return String.valueOf(FIRST_CHAR[value]) + String.valueOf(SECOND_CHAR[value]);
  }
775398
public static byte[] hexToByteArray(String hex) {
    int length = hex.length();
    byte[] result = new byte[(length / 2) + (length % 2)];
    for (int i = length, j = result.length - 1; i > 0; i -= 2, j--) {
      result[j] = hexToByte(hex.charAt(i - 1));
      if (i > 1) {
        result[j] |= (hexToByte(hex.charAt(i - 2)) << 4);
      }
    }
    return result;
  }
406486
private static String byteArrayToHexString(byte[] byteArray) {
		StringBuilder result = new StringBuilder();
		
		for (int i=0; i < byteArray.length; i++) {
			result.append(Integer.toString((byteArray[i] & 0xff) + 0x100, 16).substring(1));
		}
		
		return result.toString();
	}
1083197
public static String toHexString(byte[] bytes, int start, int len) {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < len; i++) {
            int b = bytes[start + i] & 0xFF;
            if (b < 16) buf.append('0');
            buf.append(Integer.toHexString(b));
        }
        return buf.toString();
    }
151531
public static String getHexString( byte[] bytes ) {
        try {
            byte[] hex = new byte[2 * bytes.length];
            int index = 0;

            for (byte b : bytes) {
                int v = b & 0xFF;
                hex[index++] = HEX_CHAR_TABLE[v >>> 4];
                hex[index++] = HEX_CHAR_TABLE[v & 0xF];
            }
            return new String(hex, "ASCII");
        } catch (UnsupportedEncodingException e) {
            BigInteger bi = new BigInteger(1, bytes);
            return String.format("%0" + (bytes.length << 1) + "x", bi);
        }
    }
383876
private static String byteToHexString(byte[] bytes)
  {
    final char[] hexArray = "0123456789ABCDEF".toCharArray();
    char[] hexChars = new char[bytes.length * 2];
    for (int j = 0; j < bytes.length; j++)
    {
      int v = bytes[j] & 0xFF;
      hexChars[j * 2] = hexArray[v >>> 4];
      hexChars[j * 2 + 1] = hexArray[v & 0x0F];
    }
    return new String(hexChars);
  }
521655
public static double bytesHighFirstToDouble(byte[] bytes, int start)
    {
        long l = ((long) bytes[start] << 56) & 0xFF00000000000000L;
        // 如果不强制转换为long，那么默认会当作int，导致最高32位丢失
        l |= ((long) bytes[1 + start] << 48) & 0xFF000000000000L;
        l |= ((long) bytes[2 + start] << 40) & 0xFF0000000000L;
        l |= ((long) bytes[3 + start] << 32) & 0xFF00000000L;
        l |= ((long) bytes[4 + start] << 24) & 0xFF000000L;
        l |= ((long) bytes[5 + start] << 16) & 0xFF0000L;
        l |= ((long) bytes[6 + start] << 8) & 0xFF00L;
        l |= (long) bytes[7 + start] & 0xFFL;

        return Double.longBitsToDouble(l);
    }
169567
public static String toHex(final byte[] bytes) {
        if (bytes == null) {
            return "";
        }
        StringBuffer sb = new StringBuffer(bytes.length * 2);
        for (byte b : bytes) {
            appendHex(sb, b);
        }
        return sb.toString();
    }
1135252
public static String bytesToHex(byte[] bytes, int size) {
		size=Math.min(bytes.length, size);
	    char[] hexChars = new char[size * 2];
	    for ( int j = 0; j < size; j++ ) {
	        int v = bytes[j] & 0xFF;
	        hexChars[j * 2] = hexArray[v >>> 4];
	        hexChars[j * 2 + 1] = hexArray[v & 0x0F];
	    }
	    return new String(hexChars);
	}
367826
public static byte[] convertHexStringToBytes(String hex)
    {
        if (hex.length() % 2 != 0)
        {
            throw new IllegalArgumentException("Hex string must have even number of characters.");
        }
        byte[] seed = new byte[hex.length() / 2];
        for (int i = 0; i < seed.length; i++)
        {
            int index = i * 2;
            seed[i] = (byte) Integer.parseInt(hex.substring(index, index + 2), 16);
        }
        return seed;
    }
217289
public static String toHexString(byte[] b, int offset, int length) {
        StringBuilder buf = new StringBuilder();
        for (int i = offset; i < offset + length; i++) {
            int bi = 0xff & b[i];
            int c = '0' + (bi / 16) % 16;
            if (c > '9') {
                c = 'A' + (c - '0' - 10);
            }
            buf.append((char) c);
            c = '0' + bi % 16;
            if (c > '9') {
                c = 'a' + (c - '0' - 10);
            }
            buf.append((char) c);
        }
        return buf.toString();
    }
968062
public static byte []toBytes(String hex)
  {
    if (hex == null)
      return null;
    
    int len = hex.length();

    byte []bytes = new byte[len / 2];

    int k = 0;
    for (int i = 0; i < len; i += 2) {
      int digit = 0;

      char ch = hex.charAt(i);

      if ('0' <= ch && ch <= '9')
        digit = ch - '0';
      else if ('a' <= ch && ch <= 'f')
        digit = ch - 'a' + 10;
      else if ('A' <= ch && ch <= 'F')
        digit = ch - 'A' + 10;

      ch = hex.charAt(i + 1);

      if ('0' <= ch && ch <= '9')
        digit = 16 * digit + ch - '0';
      else if ('a' <= ch && ch <= 'f')
        digit = 16 * digit + ch - 'a' + 10;
      else if ('A' <= ch && ch <= 'F')
        digit = 16 * digit + ch - 'A' + 10;

      bytes[k++] = (byte) digit;
    }

    return bytes;
  }