Here you can find the source of readTime(ByteBuffer buffer)
public static java.sql.Time readTime(ByteBuffer buffer)
//package com.java2s; //License from project: LGPL import java.nio.ByteBuffer; import java.sql.Time; import java.util.Calendar; public class Main { private static final ThreadLocal<Calendar> localCalendar = new ThreadLocal<Calendar>(); public static java.sql.Time readTime(ByteBuffer buffer) { move(6, buffer);/* w w w.j av a 2 s. co m*/ int hour = read(buffer); int minute = read(buffer); int second = read(buffer); Calendar cal = getLocalCalendar(); cal.set(0, 0, 0, hour, minute, second); return new Time(cal.getTimeInMillis()); } public static void move(int i, ByteBuffer buffer) { buffer.position(buffer.position() + i); } public static byte read(ByteBuffer buffer) { return buffer.get(); } private static final Calendar getLocalCalendar() { Calendar cal = localCalendar.get(); if (cal == null) { cal = Calendar.getInstance(); localCalendar.set(cal); } return cal; } public static void position(int i, ByteBuffer buffer) { buffer.position(i); } }