public static void main(String[] args) {

    System.out.println("Hello World!");
    /* Issue1: Display total amount of free memory available to the JVM/User */
    System.out.println("Free memory (bytes): " + Runtime.getRuntime().freeMemory());
    /* Issue2: Display the current date to the user */
    System.out.print(
        java.time.format.DateTimeFormatter.RFC_1123_DATE_TIME
                .format(java.time.ZonedDateTime.now())
                .replaceFirst(".....$", "GMT")
            + ": "); // replace UTC offset with GMT
  }
示例#2
0
 public static String getRfc1123FormattedDateTime() {
   ZonedDateTime now = ZonedDateTime.now(ZoneId.of("GMT"));
   return DateTimeFormatter.RFC_1123_DATE_TIME.format(now);
 }
 private String resolveLastModifiedRFC1123() {
   Instant instant = new Date(lastModified).toInstant();
   ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(instant, ZoneId.of("GMT"));
   return DateTimeFormatter.RFC_1123_DATE_TIME.format(zonedDateTime);
 }