Java BCD Convert To BCD2ASC(byte[] bytes)

Here you can find the source of BCD2ASC(byte[] bytes)

Description

BCDASC

License

Open Source License

Declaration

public static String BCD2ASC(byte[] bytes) 

Method Source Code

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

public class Main {

    public static String BCD2ASC(byte[] bytes) {
        char[] BToA = "0123456789abcdef".toCharArray();
        StringBuffer temp = new StringBuffer(bytes.length * 2);

        for (int i = 0; i < bytes.length; i++) {
            int h = ((bytes[i] & 0xf0) >>> 4);
            int l = (bytes[i] & 0x0f);
            temp.append(BToA[h]).append(BToA[l]);
        }//from   ww  w .  j  a  va 2s. co m
        return temp.toString();
    }

    public static String toString(Object value) {
        return value == null || "null".equals(value.toString()) ? "" : value.toString();
    }
}

Related

  1. bcd2Ascii(byte[] bytes)
  2. bcd2str(byte[] b)
  3. bcd2str(byte[] b, int offset, int len, boolean padLeft)
  4. bcd2Str(byte[] bytes)