Java Byte to Hex byteToHex(final byte[] data)

Here you can find the source of byteToHex(final byte[] data)

Description

byte To Hex

License

Open Source License

Declaration

public static String byteToHex(final byte[] data) 

Method Source Code

//package com.java2s;
/*/* ww  w.j a v  a 2s.  c o m*/
 * Copyright (c) 2016 PrivatBank IT <acsk@privatbank.ua>. All rights reserved.
 * Redistribution and modifications are permitted subject to BSD license.
 */

public class Main {
    public static String byteToHex(final byte[] data) {
        final StringBuilder hex = new StringBuilder();

        for (int i = 0; i < data.length; i++) {
            hex.append(String.format("%02x", data[i]));
        }

        return hex.toString();
    }
}

Related

  1. byteToHex(final byte b)
  2. byteToHex(final byte b)
  3. byteToHex(final byte b, StringBuilder buffer)
  4. byteToHex(final byte value)
  5. byteToHex(final byte value, final int minLength)
  6. byteToHex(int v)