Android Byte Array to Hex Convert toHexString(byte[] buf, int offset, int length)

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

Description

to Hex String

Declaration

public static String toHexString(byte[] buf, int offset, int length) 

Method Source Code

//package com.java2s;

public class Main {
    public static String toHexString(byte[] buf, int offset, int length) {
        StringBuilder output = new StringBuilder();
        for (int i = offset; i < length; i++) {
            String strHex = Integer.toHexString(buf[offset + i] & 0xFF);
            if (strHex.length() < 2) {
                output.append('0');
            }//from   www .  j  av a  2 s  . co  m
            output.append(strHex);
            output.append(' ');
        }
        output.deleteCharAt(output.length() - 1);
        return output.toString().toUpperCase();
    }
}

Related

  1. bytesToHexString(byte[] bytes)
  2. hex2byte(byte[] b)
  3. toHex(byte[] buf)
  4. toHex(byte[] data)
  5. toHexString(byte[] b)
  6. toHexString(byte[] data)
  7. getHexString(byte[] b)
  8. getHexString(byte[] b, String splitString)
  9. toHex(byte[] b)