Android Byte Array to Hex Convert bytes2Hex(byte[] bts)

Here you can find the source of bytes2Hex(byte[] bts)

Description

bytes Hex

License

Open Source License

Declaration

public static String bytes2Hex(byte[] bts) 

Method Source Code

//package com.java2s;

public class Main {
    public static String bytes2Hex(byte[] bts) {
        String des = "";
        String tmp = null;/*  w  w  w. j  a va  2 s .  c  om*/
        for (int i = 0; i < bts.length; i++) {
            tmp = (Integer.toHexString(bts[i] & 0xFF));
            if (tmp.length() == 1) {
                des += "0";
            }
            des += tmp;
        }
        return des;
    }
}

Related

  1. byteArrayToHexString(byte[] bytes)
  2. byteArrayToHexString(byte[] bytes)
  3. bytesToHex(byte[] data)
  4. convertToHex(byte[] in)
  5. convertToHex(byte[] raw)
  6. bytes2HexString(byte[] bytes)
  7. bytes2hex(byte[] bytes)
  8. bytesToHex(byte[] bytes)
  9. bytesToHex(byte[] data)