Java Hex String Create appendHex(StringBuffer stringbuffer, byte byte0)

Here you can find the source of appendHex(StringBuffer stringbuffer, byte byte0)

Description

append Hex

License

Open Source License

Declaration

private static void appendHex(StringBuffer stringbuffer, byte byte0) 

Method Source Code

//package com.java2s;

public class Main {
    /** A table of hex digits */
    public static final char[] hexDigit = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
            'E', 'F' };

    private static void appendHex(StringBuffer stringbuffer, byte byte0) {
        stringbuffer.append(toHexChar(byte0 >> 4));
        stringbuffer.append(toHexChar(byte0));
    }/* w  w w. j ava 2 s. c  o m*/

    /**
     * Convert a nibble to a hex character
     * 
     * @param nibble
     *          the nibble to convert.
     */
    public static char toHexChar(int nibble) {
        return hexDigit[(nibble & 0xF)];
    }
}

Related

  1. appendHex(StringBuffer buf, int x)
  2. appendHex(StringBuffer buffer, byte b)
  3. appendHex(StringBuffer buffer, int value)
  4. appendHex(StringBuffer sb, byte b)
  5. appendHex(StringBuffer sbuf, char ch)
  6. appendHex(StringBuilder bld, byte b)
  7. appendHex(StringBuilder buf, int value, int width)
  8. appendHex(StringBuilder buff, int i)
  9. appendHex(StringBuilder builder, int b)