Here you can find the source of toHexChar(byte[] bArray)
public static char[] toHexChar(byte[] bArray)
//package com.java2s; /* /*w w w . java 2 s.c o m*/ * @(#)StringUtil.java 1.0 2004-10-11 * * Copyright 2005 UFIDA Software Co. Ltd. All rights reserved. * UFIDA PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { public static char[] toHexChar(byte[] bArray) { char[] digitChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; char[] charDigest = new char[bArray.length * 2]; for (int i = 0; i < bArray.length; i++) { charDigest[i * 2] = digitChars[(bArray[i] >>> 4) & 0X0F]; charDigest[i * 2 + 1] = digitChars[bArray[i] & 0X0F]; } return charDigest; } }