Here you can find the source of byteToHexString(byte[] data)
Parameter | Description |
---|---|
data | The byte array to be converted. |
public static String byteToHexString(byte[] data)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w ww .j a v a 2 s . c o m*/ * Convert the given byte array to its hex representation. * From <a href="http://stackoverflow.com/questions/2817752/java-code-to-convert-byte-to-hexadecimal">http://stackoverflow.com/questions/2817752/java-code-to-convert-byte-to-hexadecimal</a> * * @param data The byte array to be converted. * * @return The hex representation of the given byte array */ public static String byteToHexString(byte[] data) { StringBuilder sb = new StringBuilder(); for (byte b : data) { sb.append(String.format("%02X", b)); } return sb.toString(); } }