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

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

Description

bytes To Hex String

Declaration

public static String bytesToHexString(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {

    public static String bytesToHexString(byte[] bytes) {
        // http://stackoverflow.com/questions/332079
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < bytes.length; i++) {
            String hex = Integer.toHexString(0xFF & bytes[i]);
            if (hex.length() == 1) {
                sb.append('0');
            }/*from  ww w .ja  va 2 s .  co  m*/
            sb.append(hex);
        }
        return sb.toString();
    }
}

Related

  1. hexToHexString(byte[] b)
  2. toHexString(byte[] b)
  3. bytesToHexString(byte[] src)
  4. ConvertHexString(byte[] b)
  5. getHexStringOfByte(byte[] bytes)
  6. bytesToHexString(byte[] bytes)
  7. convertToHex(byte[] data)
  8. toHex(final byte[] bytes)
  9. byteArrayToHexString(byte[] b)