@@ -0,0 +1,1591 @@
+package org.jknetl.javase.essential.streams;%0A%0Aimport java.io.PrintStream;%0Aimport java.util.Calendar;%0Aimport java.util.Locale;%0A%0A/**%0A * @author jknetl%0A */%0Apublic class Exercise6 %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(%22===================== With US locale =============================%22);%0A        printValues(System.out, Locale.US);%0A        System.out.println(%22===================== With German locale =============================%22);%0A        printValues(System.out, Locale.GERMAN);%0A    %7D%0A    private static void printValues(PrintStream ps, Locale l) %7B%0A        // PrintStream  format specifiers:  %25%5Bargument_index$%5D%5Bflags%5D%5Bwidth%5D%5B.precision%5Dconversion%0A        ps.format(l, %22%25%25n stands for newline %25n%22);%0A        ps.format(l, %22You can print decimal number using %25%25d pattern: '%25d'%25n%22, 5);%0A        ps.format(l, %22You may also specify width using %25%255d: '%255d'%25n%22, 51);%0A        ps.format(l, %22You may use flags (e.g. to align to the left) width using %25%25-5d: '%25-5d'%25n%22, 51);%0A        ps.format(l, %22You may use flags (e.g. display sign for numbers) using %25%25+5d: '%25+5d'%25n%22, 51);%0A%0A        ps.format(l, %22%25n%22);%0A%0A        ps.format(l, %22you may specify precision for floating point using %25%256.3f: '%256.3f%25n'%22,  Math.PI);%0A        ps.format(l, %22you may use multiple format specifiers for an arguments with %25%251$6.3f and %25%251$10.6f: '%251$6.3f', '%251$10.6f'%22,  Math.PI);%0A%0A        ps.format(l, %22%25n%22);%0A%0A        Calendar c = Calendar.getInstance();%0A        ps.format(l, %22 You may print time using multiple specifiers such as %25%251$tH, %25%251$tM, %25%251$tS: '%251$tH':'%251$tM':'%251$tS'%25n%22, c);%0A%0A    %7D%0A%7D%0A

Implement exercise 6