Here you can find the source of bytesToHexString(byte bytes[])
Parameter | Description |
---|---|
bytes | - a byte array |
public static String bytesToHexString(byte bytes[])
//package com.java2s; //License from project: Open Source License public class Main { /**//from ww w. j a v a 2s. com * Converts a byte array to a hex string. * * @param bytes - a byte array * @return a hex string */ public static String bytesToHexString(byte bytes[]) { StringBuilder sb = new StringBuilder(); for (byte b : bytes) sb.append(String.format("%02x", b)); return sb.toString(); } }