Skip to content

Instantly share code, notes, and snippets.

@dilnei
Last active February 18, 2016 12:00
Show Gist options
  • Select an option

  • Save dilnei/c5b525443f5ea49b2d5f to your computer and use it in GitHub Desktop.

Select an option

Save dilnei/c5b525443f5ea49b2d5f to your computer and use it in GitHub Desktop.
retorna os graus do ponteiro do relogio em determinado date
package br.com.breakcaptcha.utils;
import java.util.Date;
/**
*
* @author Dilnei
*/
public class Degree {
public static void main(String args[]) {
System.out.println(new NewClass().returnsDegree(new Date()));
}
private int returnsDegree(Date d) {
int hour = 360 / 12 * d.getHours();
int min = 360 / 60 * d.getMinutes();
return Math.abs(hour - min);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment