Here you can find the source of ascii2Bcd(byte[] asc)
public static byte[] ascii2Bcd(byte[] asc)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] ascii2Bcd(byte[] asc) { int len = asc.length / 2; byte[] bcd = new byte[len]; for (int i = 0; i < len; i++) { bcd[i] = (byte) ((asc[2 * i] << 4) | asc[2 * i + 1]); }/*from w w w . j a v a2 s. c o m*/ return bcd; } }