Here you can find the source of decodeTime(byte firstByte, ByteBuffer buffer)
public static long decodeTime(byte firstByte, ByteBuffer buffer)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { private static final byte OB_DATETIME_SIGN_BIT = 2; private static final byte OB_DATETIME_LEN_MASK = 0x03; public static long decodeTime(byte firstByte, ByteBuffer buffer) { boolean isNeg = testBit(firstByte, OB_DATETIME_SIGN_BIT); long value = decodeTimeWithoutSign(firstByte, buffer); return isNeg ? -value : value; }//from w w w.j av a 2s. c o m private static boolean testBit(byte target, byte pos) { return 0 != (target & (1 << pos)); } public static long decodeTimeWithoutSign(byte firstByte, ByteBuffer buffer) { int lenMark = firstByte & OB_DATETIME_LEN_MASK; int len = 0; if (lenMark == 0) { len = 4; } else if (lenMark == 1) { len = 6; } else if (lenMark == 2) { len = 8; } long value = 0; for (int n = 0; n < len; n++) { value |= ((buffer.get() & 0xffl) << (n << 3)); } return value; } }