Here you can find the source of toHexString(final byte[] data)
Parameter | Description |
---|---|
data | a parameter |
public static String toHexString(final byte[] data)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww .jav a 2s .c o m * Converts an array of bytes into a hexadecimal representation. Not * particularly efficient. * @param data * @return */ public static String toHexString(final byte[] data) { // TODO: Write own code for conversion final StringBuilder result = new StringBuilder(); for (int i = 0; i < data.length; ++i) result.append(Integer.toHexString((data[i] & 0xFF) | 0x100).substring(1, 3)); return result.toString(); } }