Here you can find the source of createHexadecimalString(byte[] data)
Parameter | Description |
---|---|
data | The data to encode to hexadecimal string. |
public static String createHexadecimalString(byte[] data)
//package com.java2s; import java.util.Formatter; public class Main { /**/* w w w . j ava 2s . c o m*/ * Creates the hexadecimal string encoding specified data. * * @param data * The data to encode to hexadecimal string. * @return The hexadecimal string representing data. */ public static String createHexadecimalString(byte[] data) { StringBuilder sb = new StringBuilder(data.length * 2); Formatter formatter = new Formatter(sb); for (byte b : data) { formatter.format("%02x", b); } formatter.close(); return sb.toString(); } }