Android Hex String Create bytesToHexString(byte[] bArray)

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

Description

bytes To Hex String

Declaration

public static String bytesToHexString(byte[] bArray) 

Method Source Code

//package com.java2s;

public class Main {
    public static String bytesToHexString(byte[] bArray) {
        StringBuffer sb = new StringBuffer(bArray.length);

        for (int i = 0; i < bArray.length; i++) {
            String sTemp = Integer.toHexString(0xFF & bArray[i]);
            if (sTemp.length() < 2) {
                sb.append(0);//from  w  w w.ja va 2 s . c o m
            }
            sb.append(sTemp.toUpperCase());
        }
        return sb.toString();
    }
}

Related

  1. appendHex(final StringBuffer buf, final byte i)
  2. appendHex(final StringBuffer buf, final int i)
  3. toHex(final int i)
  4. appendHexJavaScriptRepresentation(int codePoint, Appendable out)
  5. appendHexJavaScriptRepresentation(StringBuilder sb, char c)
  6. makeHex(int val)
  7. makeInt(String hex)
  8. appendHexJavaScriptRepresentation(int codePoint, Appendable out)
  9. appendHexJavaScriptRepresentation(StringBuilder sb, char c)