Created
October 9, 2017 08:42
-
-
Save ssaurel/60f60ac6b853e3511abd97cfe96f1dd0 to your computer and use it in GitHub Desktop.
Hexa Time method for a tutorial on the SSaurel's Blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String getHexaTime() { | |
Calendar c = Calendar.getInstance(); | |
int h = c.get(Calendar.HOUR_OF_DAY) * 255 / 23; | |
int m = c.get(Calendar.MINUTE) * 255 / 59; | |
int s = c.get(Calendar.SECOND) * 255 / 59; | |
return "#" + String.format("%02X", h) + String.format("%02X", m) + String.format("%02X", s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment