Java Hex Calculate toHexString(byte[] byteArray, int offset, int size)

Here you can find the source of toHexString(byte[] byteArray, int offset, int size)

Description

to Hex String

License

Open Source License

Declaration

public static String toHexString(byte[] byteArray, int offset, int size) 

Method Source Code

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

public class Main {
    public static String toHexString(byte[] byteArray) {
        return toHexString(byteArray, 0, byteArray.length);
    }/*ww  w.  j a v a  2  s  . c  o  m*/

    public static String toHexString(byte[] byteArray, int offset, int size) {
        StringBuilder builder = new StringBuilder();

        for (int i = 0; i < size; i++) {

            if (i > 0)
                builder.append(' ');

            builder.append(String.format("%02X", byteArray[offset + i]));
        }

        return builder.toString();
    }
}

Related

  1. toHexString(byte[] byteArray)
  2. toHexString(byte[] byteArray)
  3. toHexString(byte[] byteArray)
  4. toHexString(byte[] byteArray)
  5. toHexString(byte[] byteArray, boolean withSpaces)
  6. toHexString(byte[] byteArray, String delim)
  7. toHexString(byte[] byteDigest)
  8. toHexString(byte[] bytes)
  9. toHexString(byte[] bytes)