Java Byte Array to Hex bytes2Hex(byte[] b)

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

Description

bytes Hex

License

Apache License

Declaration

public static String bytes2Hex(byte[] b) 

Method Source Code

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

public class Main {
    public static String bytes2Hex(byte[] b) {
        StringBuilder sb = new StringBuilder(1024);
        for (int n = 0; n < b.length; n++) {
            String s = Integer.toHexString(b[n] & 0xFF);
            sb.append((s.length() == 1) ? "0" + s : s);
        }/*www  .  ja  v  a2  s  . c om*/
        return sb.toString();
    }
}

Related

  1. bufferToHexString(byte[] data, int start, int length)
  2. bytes2Hex(byte bt)
  3. bytes2Hex(byte... values)
  4. bytes2Hex(byte[] abValue)
  5. bytes2Hex(byte[] b)
  6. bytes2Hex(byte[] bts)
  7. bytes2Hex(byte[] bts)
  8. bytes2Hex(byte[] byteArray)
  9. bytes2Hex(byte[] bytes)