Android Byte Array to Hex Convert bytesToHexString(byte[] bArray)

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

Description

bytes To Hex String

Declaration

public static final String bytesToHexString(byte[] bArray) 

Method Source Code

//package com.java2s;

public class Main {

    public static final String bytesToHexString(byte[] bArray) {
        StringBuffer sb = new StringBuffer(bArray.length);
        String sTemp;/*www.j a  va  2 s.co  m*/
        for (int i = 0; i < bArray.length; i++) {
            sTemp = Integer.toHexString(0xFF & bArray[i]);
            if (sTemp.length() < 2)
                sb.append(0);
            sb.append(sTemp.toUpperCase());
        }
        return sb.toString();
    }
}

Related

  1. byte2hex(byte[] b)
  2. bytes2HexString(byte[] data)
  3. bytes2HexString(byte[] data)
  4. toHexString(byte[] b)
  5. byteArrayToHexString(byte[] data)
  6. toHexadecimealString(byte[] data)
  7. bytesToHex(byte[] bytes)
  8. byte2hex(byte buffer)
  9. byte2hex(byte[] b)