Java Hex Calculate toHexString(byte[] b)

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

Description

to Hex String

License

Open Source License

Declaration

private static String toHexString(byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    private static String toHexString(byte[] b) {
        return toHexString(b, b.length);
    }//from  w  w  w  .j  a  v a 2  s.c om

    private static String toHexString(byte[] b, int len) {
        StringBuilder s = new StringBuilder();
        s.append("\"");
        for (int i = 0; i < len; i++) {
            if (i > 0) {
                s.append(" ");
            }
            s.append(String.format("%02x", b[i] & 0xFF));
        }
        s.append("\"");
        return s.toString();
    }
}

Related

  1. toHexString(byte[] b)
  2. toHexString(byte[] b)
  3. toHexString(byte[] b)
  4. toHexString(byte[] b)
  5. toHexString(byte[] b)
  6. toHexString(byte[] b)
  7. toHexString(byte[] b)
  8. toHexString(byte[] b)
  9. toHexString(byte[] b)