Java Byte Array to Hex String bytesToHexString(byte[] bArray)

Here you can find the source of bytesToHexString(byte[] bArray)

Description

bytes To Hex String

License

Open Source License

Parameter

Parameter Description
bArray a parameter

Return

HexString

Declaration

public static final String bytesToHexString(byte[] bArray) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*www  . j  av a2  s  .  c o  m*/
     * @param bArray
     * @return HexString
     */
    public static final String bytesToHexString(byte[] bArray) {
        StringBuffer sb = new StringBuffer(bArray.length);
        String sTemp;
        for (int i = 0; i < bArray.length; i++) {
            sTemp = Integer.toHexString(0xFF & bArray[i]);
            if (sTemp.length() < 2)
                sb.append(0);
            sb.append(sTemp);
        }
        return sb.toString();
    }
}

Related

  1. bytesToHexString(byte data[])
  2. bytesToHexString(byte[] _bytes)
  3. bytesToHexString(byte[] array)
  4. bytesToHexString(byte[] b)
  5. bytesToHexString(byte[] b, int length)
  6. bytesToHexString(byte[] bArray)
  7. bytesToHexString(byte[] bs)
  8. bytesToHexString(byte[] buf)
  9. bytesToHexString(byte[] byteArray)