Java Byte Array to Hex String bytes_to_hex(byte[] b)

Here you can find the source of bytes_to_hex(byte[] b)

Description

bytethex

License

Open Source License

Declaration

public static String bytes_to_hex(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: MIT License 

public class Main {
    public static String bytes_to_hex(byte[] b) {
        String result = "";
        for (int i = 0; i < b.length; i++) {
            result += Integer.toString((b[i] & 0xff) + 0x100, 16)
                    .substring(1);//from   ww w  .  ja va  2  s .  c  o  m
        }
        return result;
    }
}

Related

  1. bytes2hexStr(byte[] arr, int len)
  2. bytes_to_hex(byte[] bytes)
  3. bytesToHexAppend(byte[] bs, int off, int length, StringBuffer sb)
  4. bytesToHexChars(byte[] bytes)
  5. bytesToHexChars(byte[] bytes)