Android StringBuilder Append byteToString(StringBuilder sb, byte b)

Here you can find the source of byteToString(StringBuilder sb, byte b)

Description

byte To String

License

Apache License

Declaration

static void byteToString(StringBuilder sb, byte b) 

Method Source Code

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

public class Main {
    static void byteToString(StringBuilder sb, byte b) {
        int unsigned_byte = b < 0 ? b + 256 : b;
        int hi = unsigned_byte / 16;
        int lo = unsigned_byte % 16;
        sb.append("0123456789ABCDEF".substring(hi, hi + 1));
        sb.append("0123456789ABCDEF".substring(lo, lo + 1));
    }//from   ww  w  .  j  a  v  a 2 s .  co  m
}

Related

  1. appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading)
  2. appendLine(final StringBuilder s, final CharSequence line)
  3. appendStr(char splitTag, Object... strs)
  4. addStartLine(Object aObject, StringBuilder aResult)
  5. appendByteAsHex(StringBuilder sb, byte b)