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

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

Description

get Hex String Of Byte

License

Apache License

Declaration

public static String getHexStringOfByte(byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String getHexStringOfByte(byte[] bytes) {
        StringBuffer hexValue = new StringBuffer();
        for (int i = 0; i < bytes.length; i++) {
            int val = (bytes[i]) & 0xff;
            if (val < 16) {
                hexValue.append("0");
            }//from w w w  .  j  a  v  a 2s  .c o  m
            hexValue.append(Integer.toHexString(val));
        }
        return hexValue.toString();
    }
}

Related

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