This is an absolutely math problem:
1. calculate minute angle: 360/60*minutes
2. calculate hour angle: 360/12*hour%12
3. calculate hour angle's plus, because the hour hand cannot jump from one hour to another, it should be somewhere between two hours according to minutes: (360/12)*(munutes/(360/60))
4. The angle either be smaller than 180 or larger than 180, if it's larger than 180, we need (360-angle).
public double angleClock(int hour, int minutes) { double minAngle = minutes * 6; double hourAngle = hour%12 * 30; double hourAnglePlus = 30*minutes/60.0; hourAngle += hourAnglePlus; double res = Math.abs(hourAngle-minAngle); if(res>180) //or res = Math.min(res, 360-res); return 360-res; else return res; }