Here you can find the source of toHexString(byte[] data)
Parameter | Description |
---|---|
data | the bytearray to stringize |
data
public static String toHexString(byte[] data)
//package com.java2s; public class Main { /**/*w ww. j a v a 2 s .co m*/ * Turn a bytearray into a printable form, representing * each byte in hex. * * @param data the bytearray to stringize * @return a hex-encoded printable representation of <code>data</code> */ public static String toHexString(byte[] data) { StringBuffer sb = new StringBuffer(data.length * 2); for (int i = 0; i < data.length; ++i) { sb.append(Integer.toHexString((data[i] >> 4) & 15)); sb.append(Integer.toHexString(data[i] & 15)); } return sb.toString(); } }