Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Calendar;
- import java.util.Random;
- public class HourAndMinute {
- public static void main(String[] args) {
- Calendar c = Calendar.getInstance();
- c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE), 0,
- 0, 0);
- c.set(Calendar.MILLISECOND, 0);
- Calendar d = (Calendar )c.clone();
- d.add(Calendar.DATE, 1);
- StringBuilder sb = new StringBuilder();
- while (c.compareTo(d) < 0) {
- Random r = new Random();
- sb.append(String.format("%tk:%tM %08d\n", c, c,
- r.nextInt((int )Math.pow(10, 8) - 1)));
- c.add(Calendar.MINUTE, 5);
- }
- System.out.println(sb);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement