Here you can find the source of toHexString(byte b[])
Parameter | Description |
---|---|
b | a parameter |
public static String toHexString(byte b[])
//package com.java2s; //License from project: Open Source License public class Main { private static char hexChar[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; /**//from w w w .ja v a2 s .c om * Byte array to Hex string * * @param b * @return */ public static String toHexString(byte b[]) { StringBuilder sb = new StringBuilder(b.length * 2); for (int i = 0; i < b.length; i++) { sb.append(hexChar[(b[i] & 0xf0) >>> 4]); sb.append(hexChar[b[i] & 0xf]); } return sb.toString(); } }