Here you can find the source of byteToHex(byte[] data)
Parameter | Description |
---|---|
data | The byte array to be converted. |
public static String byteToHex(byte[] data)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a va 2 s. c om*/ * Converts the content of a byte array into a human readable form. * * @param data The byte array to be converted. * @return The hex converted byte array. */ public static String byteToHex(byte[] data) { StringBuilder sb = new StringBuilder(); for (byte b : data) { sb.append(String.format("%02X", b)); } return sb.toString(); } }