Java Byte Array to Hex bufferToHexString(byte[] data, int start, int length)

Here you can find the source of bufferToHexString(byte[] data, int start, int length)

Description

buffer To Hex String

License

Open Source License

Declaration

public static String bufferToHexString(byte[] data, int start, int length) 

Method Source Code

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

public class Main {
    public static String bufferToHexString(byte[] data, int start, int length) {
        int i;//from ww w. j  a v  a 2 s.c o m
        int myStop;
        StringBuilder sb = new StringBuilder();
        //byte [] subArray = Arrays.copyOfRange(a, 4, 6);
        myStop = (length > data.length) ? data.length : length;
        for (i = start; i < start + myStop; i++) {
            sb.append(String.format("%02x ", data[i]));
        }
        return sb.toString();
    }
}

Related

  1. bufferToHex(byte bytes[])
  2. bufferToHexString(byte[] buffer)
  3. bytes2Hex(byte bt)
  4. bytes2Hex(byte... values)
  5. bytes2Hex(byte[] abValue)
  6. bytes2Hex(byte[] b)