Android Byte Array to Hex Convert byteArrayToHexString(byte[] b)

Here you can find the source of byteArrayToHexString(byte[] b)

Description

byte Array To Hex String

Declaration

public static String byteArrayToHexString(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    public static String byteArrayToHexString(byte[] b) {
        StringBuffer sb = new StringBuffer(b.length * 2);
        for (int i = 0; i < b.length; i++) {
            int v = b[i] & 0xff;
            if (v < 16) {
                sb.append('0');
            }// w  ww  . j  av a  2s  . c o m
            sb.append(Integer.toHexString(v));
        }
        return sb.toString().toUpperCase();
    }
}

Related

  1. byte2hex(byte buffer)
  2. byte2hex(byte[] b)
  3. byte2hex(byte[] buffer)
  4. byte2hex(byte[] buffer, int len)
  5. byte2hexWithoutSpace(byte[] buffer)
  6. byteArrayToHexString(final byte[] array)
  7. byteToHexString(Byte b)
  8. byteToHexString(byte b)
  9. byteToHexString(byte value)