Here you can find the source of Bcd2Str(byte[] b)
Parameter | Description |
---|---|
b | a parameter |
public static String Bcd2Str(byte[] b)
//package com.java2s; public class Main { /**/* w w w .ja va 2s . c o m*/ * * @param b * @return */ public static String Bcd2Str(byte[] b) { StringBuffer sb = new StringBuffer(b.length * 2); for (int i = 0; i < b.length; i++) { sb.append((byte) (b[i] & 0xF0) >> 4); sb.append((byte) (b[i] & 0x0F)); } return sb.toString().substring(0, 1).equalsIgnoreCase("0") ? sb .toString().substring(1) : sb.toString(); } }