Java BCD Convert To bcd2str(byte[] b)

Here you can find the source of bcd2str(byte[] b)

Description

bcdstr

License

Open Source License

Declaration

private static String bcd2str(byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    private static String bcd2str(byte[] b) {
        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < b.length; ++i) {
            int h = ((b[i] & 255) >> 4) + 48;
            sb.append((char) h);
            int l = (b[i] & 15) + 48;
            sb.append((char) l);
        }/*w  ww  .  j a  v a2  s .c  o m*/

        return sb.toString();
    }
}

Related

  1. BCD2ASC(byte[] bytes)
  2. bcd2Ascii(byte[] bytes)
  3. bcd2str(byte[] b, int offset, int len, boolean padLeft)
  4. bcd2Str(byte[] bytes)
  5. bcd2String(byte[] bytes)
  6. bcdNibbleToInt(byte b, boolean high)