Here you can find the source of formatDate(byte[] btValue, int iOffset, int iLength)
public static String formatDate(byte[] btValue, int iOffset, int iLength)
//package com.java2s; //License from project: Apache License public class Main { public static String formatDate(byte[] btValue, int iOffset, int iLength) { if ((btValue.length < iOffset + iLength) || (iLength < 4)) return ""; return getBCDString(btValue[iOffset + 3]) + "/" + getBCDString(btValue[iOffset + 2]) + "/" + getBCDString(btValue[iOffset + 0]) + getBCDString(btValue[iOffset + 1]); }//www.j av a 2 s .co m public static String getBCDString(byte btValue) { byte l, h; h = (byte) ((btValue & 0xF0) >>> 4); if (h < 10) h = (byte) ('0' + h); else h = (byte) ('A' + h - 10); l = (byte) ((btValue & 0x0F)); if (l < 10) l = (byte) ('0' + l); else l = (byte) ('A' + l - 10); return String.valueOf((char) h) + String.valueOf((char) l); } }