Here you can find the source of toHexString(byte[] keyData)
Parameter | Description |
---|---|
keyData | a parameter |
private static String toHexString(byte[] keyData)
//package com.java2s; public class Main { /**// www. j a va 2s. c o m * to hex string * @param keyData * @return */ private static String toHexString(byte[] keyData) { if (keyData == null) { return null; } int expectedStringLen = keyData.length * 2; StringBuilder sb = new StringBuilder(expectedStringLen); for (int i = 0; i < keyData.length; i++) { String hexStr = Integer.toString(keyData[i] & 0x00FF, 16); if (hexStr.length() == 1) { hexStr = "0" + hexStr; } sb.append(hexStr); } return sb.toString(); } }