Here you can find the source of bytesToHex(byte[] bytes)
Parameter | Description |
---|---|
bytes | the bytes to convert to hex. |
private static String bytesToHex(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w.j a v a 2 s. co m * Bytes to hex. * * @param bytes the bytes to convert to hex. * @return the hex representation of bytes. */ private static String bytesToHex(byte[] bytes) { StringBuffer result = new StringBuffer(); for (byte b : bytes) result.append(Integer.toString((b & 0xff) + 0x100, 16).substring(1)); return result.toString(); } }