Here you can find the source of formatTime(byte[] btValue, int iOffset, int iLength)
public static String formatTime(byte[] btValue, int iOffset, int iLength)
//package com.java2s; //License from project: Apache License public class Main { public static String formatTime(byte[] btValue, int iOffset, int iLength) { if ((btValue.length < iOffset + iLength) || (iLength < 3)) return ""; return getBCDString(btValue[iOffset + 0]) + ":" + getBCDString(btValue[iOffset + 1]) + ":" + getBCDString(btValue[iOffset + 2]); }//from w w w . ja va 2 s. c o 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); } }