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

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

Description

to Hex String

Declaration

private static String toHexString(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {
    private static String toHexString(byte[] bytes) {
        StringBuilder sb = new StringBuilder();
        for (byte b : bytes) {
            int unsignedB = b & 0xff;
            if (unsignedB < 0x10)
                sb.append("0");
            sb.append(Integer.toHexString(unsignedB));
        }//  w w  w . j  ava 2 s.  c  om
        return sb.toString();
    }
}

Related

  1. toHex(byte[] bytes, String separator)
  2. toHex(byte[] bytes, int offset, int length)
  3. toHex(byte[] bytes, int offset, int length, String separator)
  4. toHex(byte[] dataBytes)
  5. toHexString(byte[] ba)
  6. toHexString(byte[] bytes)
  7. toHexString(byte[] bytes)
  8. toHexString(byte[] bytes, int offset, int length)
  9. toHexString(byte[] keyData)