fork download
  1. class Application {
  2. private static void whitespace(int count) {
  3. StringBuilder sb = new StringBuilder();
  4. while (count-- > 0)
  5. sb.append(' ');
  6. System.out.print(sb.toString());
  7. }
  8.  
  9. private static void print(int count) {
  10. whitespace(count);
  11. System.out.print('w');
  12. }
  13.  
  14. public static void main(String[] args) {
  15. final int space = 10;
  16. for (int i = 0; i < space; i++) {
  17. print(i / 2);
  18. print(space - i);
  19. print(i);
  20. print(space - i);
  21. System.out.println();
  22. }
  23. }
  24. }
  25.  
Success #stdin #stdout 0.1s 320320KB
stdin
Standard input is empty
stdout
w          ww          w
w         w w         w
 w        w  w        w
 w       w   w       w
  w      w    w      w
  w     w     w     w
   w    w      w    w
   w   w       w   w
    w  w        w  w
    w w         w w