Skip to content

Instantly share code, notes, and snippets.

@shixiaoyu
Created July 21, 2020 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shixiaoyu/2e0f17d82bffa7874c4b54bad18f45f7 to your computer and use it in GitHub Desktop.
Save shixiaoyu/2e0f17d82bffa7874c4b54bad18f45f7 to your computer and use it in GitHub Desktop.
public double angleClock(int hour, int minutes) {
if (hour == 12) {
hour = 0;
}
double angle = Math.abs(minutes * 6 - (hour + (double)minutes / 60) * 30);
if (angle > 180) {
angle = 360 - angle;
}
return angle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment