Created
April 10, 2020 04:12
-
-
Save Paulius11/9bfd3a46ba59696c33bdda591594d55a to your computer and use it in GitHub Desktop.
java snippet
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
#Random | |
## Secure random generating | |
private static final int NUMBER_OF_CARDS = 52; | |
private static final SecureRandom randomNumbers = new SecureRandom(); | |
int second = randomNumbers.nextInt(NUMBER_OF_CARDS) | |
#Printing | |
##Printing values with leading zeros 0: | |
System.out.printf("valu:e %s%n", counter ); | |
String.format("%02d:%02d:%02d", hour, minute, second); | |
String.format("%d:%02d:%02d %s", ((hour == 0 || hour == 12) ? 12 : hour % 12), minute, second, (hour < 12 ? "AM" : "PM")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment