Java Hex String Create appendHex(StringBuffer buffer, byte b)

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

Description

append Hex

License

Apache License

Declaration

private static void appendHex(StringBuffer buffer, byte b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static final char[] hexDigit = "0123456789abcdef".toCharArray();

    private static void appendHex(StringBuffer buffer, byte b) {
        buffer.append(hexDigit[(b >> 4) & 15]).append(hexDigit[b & 15]);
    }/*from  w w w  . ja  v a 2  s . c o m*/

    private static void appendHex(StringBuffer buffer, byte[] b) {
        for (int i = 0; i < b.length; ++i)
            buffer.append(hexDigit[(b[i] >> 4) & 15]).append(hexDigit[b[i] & 15]);
    }
}

Related

  1. appendHex(final StringBuffer buf, final byte i)
  2. appendHex(final StringBuffer buf, final int i)
  3. appendHex(int color, StringBuffer buffer)
  4. appendHex(StringBuffer buf, int x)
  5. appendHex(StringBuffer buffer, int value)
  6. appendHex(StringBuffer sb, byte b)
  7. appendHex(StringBuffer sbuf, char ch)
  8. appendHex(StringBuffer stringbuffer, byte byte0)