Here you can find the source of Bcd2Ascii(byte[] bcd)
Parameter | Description |
---|---|
bcd | a parameter |
public static String Bcd2Ascii(byte[] bcd)
//package com.java2s; public class Main { public final static char[] BToA = "0123456789abcdef".toCharArray(); /**// ww w .ja v a 2s .c o m * Bcd to Ascii(String) * @param bcd * @return */ public static String Bcd2Ascii(byte[] bcd) { StringBuffer sb = new StringBuffer(bcd.length * 2); for (int i = 0; i < bcd.length; i++) { int h = ((bcd[i] & 0xF0) >> 4); int l = (bcd[i] & 0x0F); sb.append(BToA[h]).append(BToA[l]); } return sb.toString(); } }