Here you can find the source of toHexString(byte[] v)
Parameter | Description |
---|---|
v | a parameter |
public static String toHexString(byte[] v)
//package com.java2s; /*//from w w w . j ava2s .co m * Copyright (c) 2007-2012 The Broad Institute, Inc. * SOFTWARE COPYRIGHT NOTICE * This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved. * * This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality. * * This software is licensed under the terms of the GNU Lesser General Public License (LGPL), * Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php. */ public class Main { /** * Convert an array of bytes to a hex string. * * @param v * @return */ public static String toHexString(byte[] v) { final String HEX_DIGITS = "0123456789abcdef"; StringBuffer sb = new StringBuffer(v.length * 2); for (int i = 0; i < v.length; i++) { int b = v[i] & 0xFF; sb.append(HEX_DIGITS.charAt(b >>> 4)).append( HEX_DIGITS.charAt(b & 0xF)); } return sb.toString(); } }