Here you can find the source of toHex(final byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static String toHex(final byte[] bytes)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w ww . jav a 2 s . c o m*/ * Copied from the old Hex.java, needed for MD5 handling * * @param bytes * @return the hex string */ public static String toHex(final byte[] bytes) { StringBuilder sb = new StringBuilder(); for (final byte b : bytes) { String s = Integer.toHexString(0xff & b); if (s.length() < 2) { sb.append("0"); } sb.append(s); } return sb.toString(); } }