fork download
  1. class Test {
  2. public static void main(String[] args) {
  3. java.util.function.Function<Integer[], String> f = a -> {
  4. String s = "";
  5. for (int i = a.length, j = i; i-- > 0;)
  6. s += "%" + j + "s";
  7. return s.format(s, a);
  8. };
  9.  
  10. System.out.println(f.apply(new Integer[] {0}));
  11. System.out.println(f.apply(new Integer[] {2, 10}));
  12. System.out.println(f.apply(new Integer[] {7, 8, 9, 10}));
  13. System.out.println(f.apply(new Integer[] {1, 33, 333, 7777}));
  14. System.out.println(f.apply(new Integer[] {0, 0, 0, 0, 0, 0}));
  15. }
  16. }
Success #stdin #stdout 0.08s 711680KB
stdin
Standard input is empty
stdout
0
 210
   7   8   9  10
   1  33 3337777
     0     0     0     0     0     0