Java Hex Calculate toHexBytes(byte[] bytes)

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

Description

to Hex Bytes

License

Open Source License

Parameter

Parameter Description
bytes The bytes

Return

A string representation of the bytes in hex

Declaration

public static String toHexBytes(byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w w w . ja v  a 2s  .com*/
     * @param bytes The bytes
     *
     * @return A string representation of the bytes in hex
     */
    public static String toHexBytes(byte[] bytes) {
        StringBuilder buffer = new StringBuilder();
        for (byte b : bytes) {
            buffer.append(String.format(" %02x", b));
        }
        return buffer.toString();
    }
}

Related

  1. toHexByte(byte b, StringBuffer sb)
  2. toHexByte(final char ch1, final char ch2)
  3. toHexByte(int bite)
  4. toHexByte(int i)
  5. toHexByteArray(final byte[] buffer)
  6. toHexBytes(byte[] data)
  7. toHexBytes(byte[] toBeConverted)
  8. toHexChar(byte[] bArray)
  9. toHexChar(char ch, StringBuffer sb)