Here you can find the source of toHexPadZero(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static String toHexPadZero(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { private static final char[] hexChars = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; /**//from w w w . j a v a2 s. com * Convert bytes to hexadecimal representation. * Pad left with zeroes if necessary * @param bytes * @return */ public static String toHexPadZero(byte[] bytes) { StringBuilder ret = new StringBuilder(bytes.length * 2); for (byte b : bytes) { ret.append(hexChars[(b >> 4) & 0xF]); ret.append(hexChars[b & 0xF]); } return ret.toString(); } }