Here you can find the source of appendHex(StringBuilder bld, byte b)
public static void appendHex(StringBuilder bld, byte b)
//package com.java2s; /**/*w ww .j av a 2 s .c o m*/ * Copyright (c) 2013 Puppet Labs, Inc. and other contributors, as listed below. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Puppet Labs */ public class Main { private static final char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static void appendHex(StringBuilder bld, byte b) { bld.append(hexChars[(b & 0xf0) >> 4]); bld.append(hexChars[b & 0x0f]); } public static void appendHex(StringBuilder bld, byte[] digest) { for (int idx = 0; idx < digest.length; ++idx) appendHex(bld, digest[idx]); } }