Here you can find the source of hexToHexString(byte[] b)
Parameter | Description |
---|---|
b | a parameter |
public static String hexToHexString(byte[] b)
//package com.java2s; import java.util.Locale; public class Main { /**/*from w w w. j av a 2 s. c om*/ * * @param b * @return */ public static String hexToHexString(byte[] b) { int len = b.length; int[] x = new int[len]; String[] y = new String[len]; StringBuilder str = new StringBuilder(); int j = 0; for (; j < len; j++) { x[j] = b[j] & 0xff; y[j] = Integer.toHexString(x[j]); while (y[j].length() < 2) { y[j] = "0" + y[j]; } str.append(y[j]); str.append(""); } return new String(str).toUpperCase(Locale.getDefault()); } }