Android Hex String Create byte2hex(byte[] bytes)

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

Description

bytehex

Declaration

private static String byte2hex(byte[] bytes) 

Method Source Code

//package com.java2s;

public class Main {
    private static String byte2hex(byte[] bytes) {
        StringBuilder sign = new StringBuilder();
        for (int i = 0; i < bytes.length; i++) {
            String hex = Integer.toHexString(bytes[i] & 0xFF);
            if (hex.length() == 1) {
                sign.append("0");
            }//from www . j  a  v a2 s.c  o m
            sign.append(hex.toUpperCase());
        }
        return sign.toString();
    }
}

Related

  1. hexToBt64(String hex)
  2. hexToBytes(String hex)
  3. convertToHex(byte[] data)
  4. convertToHex(byte[] data)
  5. byte2HexStr(byte[] b, int length)
  6. bytesToHex(byte[] bytes)
  7. encodeHex(byte[] bytes)
  8. encodeHex(byte[] pData)
  9. hex(int value, int digits)