Android StringBuffer Append appendHex(StringBuffer sb, byte b)

Here you can find the source of appendHex(StringBuffer sb, byte b)

Description

utility function to transfer the byte data.

License

Open Source License

Parameter

Parameter Description
sb the string to be appended new character.
b the byte data

Declaration

private static void appendHex(StringBuffer sb, byte b) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   www .  j a  v a2  s  .c  om
     * Padding HEX string.
     */
    public static final String HEX = "0123456789ABCDEF";

    /**
     * utility function to transfer the byte data.
     * @param sb the string to be appended new character.
     * @param b the byte data
     */
    private static void appendHex(StringBuffer sb, byte b) {
        sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f));
    }
}