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

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

Description

to Hex String

Declaration

public static String toHexString(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {

    public static String toHexString(byte[] bytes) {
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < bytes.length; i++) {
            sb.append(toHexString(bytes[i]));
        }/* ww  w.  jav a 2 s  . c  o m*/

        return sb.toString();
    }

    public static String toHexString(byte oneByte) {
        return String.format("%02x", oneByte);
    }
}

Related

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