Here you can find the source of getHours()
public static final int getHours()
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static final int getHours() { return Calendar.getInstance().get(Calendar.HOUR_OF_DAY); }/*w w w. j a va 2 s .com*/ public static final int getHours(long time, boolean wrap) { return (int) (wrap ? ((time / 3600000l) % 24) : (time / 3600000l)); } }