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

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

Description

bytes To Hex String

Declaration

public static String bytesToHexString(byte[] src) 

Method Source Code

//package com.java2s;

public class Main {
    public static String bytesToHexString(byte[] src) {
        StringBuilder stringBuilder = new StringBuilder("");
        if (src == null || src.length <= 0) {
            return null;
        }/*  ww  w . ja v a2 s . com*/
        for (int i = 0; i < src.length; i++) {
            int v = src[i] & 0xFF;
            String hv = Integer.toHexString(v);
            if (hv.length() < 2) {
                stringBuilder.append(0);
            }
            stringBuilder.append(hv);
        }
        return stringBuilder.toString();
    }
}

Related

  1. getHexString(byte[] b, String splitString)
  2. toHex(byte[] b)
  3. bytesToHexString(byte[] bytes)
  4. hexToHexString(byte[] b)
  5. toHexString(byte[] b)
  6. ConvertHexString(byte[] b)
  7. getHexStringOfByte(byte[] bytes)
  8. bytesToHexString(byte[] bytes)
  9. bytesToHexString(byte[] bytes)