Here you can find the source of getCurrentHour()
public static int getCurrentHour()
//package com.java2s; import java.util.Calendar; public class Main { public static int getCurrentHour() { Calendar c = Calendar.getInstance(); return c.get(Calendar.HOUR_OF_DAY); }// www . j a v a 2 s . co m }