Here you can find the source of toHexString(byte[] binary)
Parameter | Description |
---|---|
binary | the byte array to convert |
public static String toHexString(byte[] binary)
//package com.java2s; /*/*from w ww .ja va2 s.c o m*/ * Copyright 2009 Jagornet Technologies, LLC. All Rights Reserved. * * This software is the proprietary information of Jagornet Technologies, LLC. * Use is subject to license terms. * */ public class Main { /** * To hex string. * * @param binary the byte array to convert * * @return the string the converted hex string */ public static String toHexString(byte[] binary) { if (binary != null) { StringBuffer str = new StringBuffer(binary.length * 2); for (int i = 0; i < binary.length; i++) { int v = (binary[i] << 24) >>> 24; str.append((v < 0x10 ? "0" : "") + Integer.toHexString(v)); } return str.toString(); } return null; } }