Here you can find the source of byteToBcd(byte src)
private static byte byteToBcd(byte src)
//package com.java2s; //License from project: Apache License public class Main { private static byte byteToBcd(byte src) { byte re = src; if (src <= 0x39 && src >= 0x30) re = (byte) (src - 0x30); else if (src <= 0x46 && src >= 0x41) re = (byte) (src - 0x37); else if (src <= 0x66 && src >= 0x61) re = (byte) (src - 0x57); return re; }//from www . ja v a 2s . c om }