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

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

Description

bytes To Hex String

Declaration

private static String bytesToHexString(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {
    private static String bytesToHexString(byte[] bytes) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < bytes.length; i++) {
            String hex = Integer.toHexString(0xFF & bytes[i]);
            if (hex.length() == 1) {
                sb.append('0');
            }//from  w w w .ja v  a  2 s .  c om
            sb.append(hex);
        }
        return sb.toString();
    }
}

Related

  1. toHexString(byte[] buf, int offset, int length)
  2. toHexString(byte[] data)
  3. getHexString(byte[] b)
  4. getHexString(byte[] b, String splitString)
  5. toHex(byte[] b)
  6. hexToHexString(byte[] b)
  7. toHexString(byte[] b)
  8. bytesToHexString(byte[] src)
  9. ConvertHexString(byte[] b)