fork download
  1.  
  2.  
  3. class Ideone {
  4. public static String stringRepeat(String str, int times) {
  5. return new String(new char[times]).replace("\0", str);
  6. }
  7. public static void drawRectRow(String left, String filler, String right, int w) {
  8. System.out.print(left + stringRepeat(filler, w - 2) + right);
  9. }
  10. public static void drawRect(int w, int h) {
  11. w *= 2.5; //Для ровности так как высота символа всегда больше.
  12. drawRectRow("╔", "═", "╗\n", w);
  13. for (int i = 0; i < h; i++) {
  14. drawRectRow("║", " ", "║\n", w);
  15. }
  16. drawRectRow("╚", "═", "╝", w);
  17. }
  18. public static void main(String[] args) {
  19. drawRect(10, 10);
  20. }
  21.  
  22. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
╔═══════════════════════╗
║                       ║
║                       ║
║                       ║
║                       ║
║                       ║
║                       ║
║                       ║
║                       ║
║                       ║
║                       ║
╚═══════════════════════╝